HBase跨集群表复制

Stella981
• 阅读 490

概述

A集群HBase中有个表testTableCopy, 要将其复制到B集群的HBase中。

使用HBase表复制工具./hbase org.apache.hadoop.hbase.mapreduce.CopyTable

root@host:/tstar/hbase/bin-->./hbase org.apache.hadoop.hbase.mapreduce.CopyTable
Usage: CopyTable [general options] [--starttime=X] [--endtime=Y] [--new.name=NEW] [--peer.adr=ADR] <tablename>

Options:
 rs.class     hbase.regionserver.class of the peer cluster
              specify if different from current cluster
 rs.impl      hbase.regionserver.impl of the peer cluster
 startrow     the start row
 stoprow      the stop row
 starttime    beginning of the time range (unixtime in millis)
              without endtime means from starttime to forever
 endtime      end of the time range.  Ignored if no starttime specified.
 versions     number of cell versions to copy
 new.name     new table's name
 peer.adr     Address of the peer cluster given in the format
              hbase.zookeeer.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent
 families     comma-separated list of families to copy
              To copy from cf1 to cf2, give sourceCfName:destCfName. 
              To keep the same name, just give "cfName"
 all.cells    also copy delete markers and deleted cells
 bulkload     Write input into HFiles and bulk load to the destination table

Args:
 tablename    Name of the table to copy

Examples:
 To copy 'TestTable' to a cluster that uses replication for a 1 hour window:
 $ bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable --starttime=1265875194289 --endtime=1265878794289 --peer.adr=server1,server2,server3:2181:/hbase --families=myOldCf:myNewCf,cf2,cf3 TestTable 
For performance consider the following general options:
-Dhbase.client.scanner.caching=100
-Dmapred.map.tasks.speculative.execution=false

准备

  1. 工具必须在A集群HBase master节点上进行;
  2. 在A集群HBase master节点上须要配置B集群HBase的相关主机名到hosts中,原则上是zookeeper及HBase相关节点主机名;
  3. 在B集群HBase中预先建好复制的目标表,目标表的表名可以和原始的表名,目标表的列族名和来源表的列族名,可以不同;

执行复制

./hbase -Dhbase.root.logger=INFO,RFA -Dhbase.log.dir=/tmp -Dhbase.log.file=copytable.log org.apache.hadoop.hbase.mapreduce.CopyTable --peer.adr=test61,test62,test63:2181:/hbase --families=1 "tstar:testTableCopy"
点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Stella981 Stella981
2年前
Hive 数据导入HBase的2种方法详解
最近经常被问到这个问题,所以简单写一下总结。Hive数据导入到HBase基本有2个方案:  1、HBase中建表,然后Hive中建一个外部表,这样当Hive中写入数据后,HBase中也会同时更新  2、MapReduce读取Hive数据,然后写入(API或者Bulkload)到HBase1、Hive外部表创
Stella981 Stella981
2年前
Hbase表两种数据备份方法
Hbase表两种数据备份方法导入和导出示例本文将提供两种备份方法——1)基于Hbase提供的类对hbase中某张表进行备份2)基于Hbasesnapshot数据快速备份方法场合:由于线上和测试环境是分离的,无法在测试环境访问线上库,所以需要将线上的hbase表导出一部分到测试环境中的hbase表,这就是本文的由来。
Stella981 Stella981
2年前
HBase四种部署模式和基本操作
本文主要包括两部分的内容,第一部分主要包HBase的四种安装方法,分别是:①单机版模式,②伪集群模式,③使用HBase自带的zookeeper构建分布式集群,④使用独立安装的zookeeper构建分布式集群。第二部分通过HBaseshell,展示HBase的基本操作,如创建表、插入记录、查询记录、删除记录等。HBase的部署方式包括:部署模
Stella981 Stella981
2年前
HBase 在HDFS上的物理目录结构
根目录配置项<namehbase.rootdir</name默认“/hbase”根级文件/hbase/WALs被HLog实例管理的WAL文件。/hbase/WALs/datahbase.com,60020,1443159380730对于每个HregionServer,日志目录中都包含一个对应的子目录
Stella981 Stella981
2年前
HBase生产环境优化不完全指南
HBase使用定位:大规模数据高并发毫秒级响应的OLTP实时系统(数据库)。集群部署架构HBase集群一旦部署使用,再想对其作出调整需要付出惨痛代价,所以如何部署HBase集群是使用的第一个关键步骤。以下是HBase集群使用以来的部署架构变化以及对应的分析。第一阶段硬件混合型软件混合型集群集群规模:20
Stella981 Stella981
2年前
HBase–常用Shell操作篇
HBase为用户提供了一个Shell终端进行交互操作,通过“helpget”命令可以获得帮助信息。【查询相关】1\.进入hbaseshellconsole  $HBASE\_HOME/bin/hbaseshell2\.查看有哪些表  list3\.查看全表数据   scan'tablename'
Stella981 Stella981
2年前
HBase启动失败
如果在hbase的shell中输入了status报错,hbase(main):001:0statusERROR:org.apache.hadoop.hbase.ipc.ServerNotRunningYetException:Serverisnotrunningyetatorg.apache.ha
Stella981 Stella981
2年前
HBase应该如何优化?
1HBase高可用在HBase中Hmaster负责监控RegionServer的生命周期,均衡RegionServer的负载,如果Hmaster挂掉了,那么整个HBase集群将陷入不健康的状态,此时的工作状态并不会维持太久。所以需要配置hbase的高可用2预分区
Stella981 Stella981
2年前
Hbase基础篇
hbase存储:HBase存储数据其底层使用的是HDFS来作为存储介质,HBase的每一张表对应的HDFS目录上的一个文件夹,文件夹名以HBase表进行命名(如果没有使用命名空间,则默认在default目录下),在表文件夹下存放在若干个Region命名的文件夹,Region文件夹中的每个列簇也是用文件夹进行存储的,每个列簇中存储就是实际的数据,以HF