HBase跨集群表复制

概述

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

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

1root@host:/tstar/hbase/bin-->./hbase org.apache.hadoop.hbase.mapreduce.CopyTable 2Usage: CopyTable [general options] [--starttime=X] [--endtime=Y] [--new.name=NEW] [--peer.adr=ADR] <tablename> 3 4Options: 5 rs.class hbase.regionserver.class of the peer cluster 6 specify if different from current cluster 7 rs.impl hbase.regionserver.impl of the peer cluster 8 startrow the start row 9 stoprow the stop row 10 starttime beginning of the time range (unixtime in millis) 11 without endtime means from starttime to forever 12 endtime end of the time range. Ignored if no starttime specified. 13 versions number of cell versions to copy 14 new.name new table's name 15 peer.adr Address of the peer cluster given in the format 16 hbase.zookeeer.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent 17 families comma-separated list of families to copy 18 To copy from cf1 to cf2, give sourceCfName:destCfName. 19 To keep the same name, just give "cfName" 20 all.cells also copy delete markers and deleted cells 21 bulkload Write input into HFiles and bulk load to the destination table 22 23Args: 24 tablename Name of the table to copy 25 26Examples: 27 To copy 'TestTable' to a cluster that uses replication for a 1 hour window: 28 $ 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 29For performance consider the following general options: 30-Dhbase.client.scanner.caching=100 31-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"
点赞
收藏

评论区

加载中...

相关推荐

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

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

Hive 数据导入HBase的2种方法详解

最近经常被问到这个问题,所以简单写一下总结。Hive数据导入到HBase基本有2个方案:  1、HBase中建表,然后Hive中建一个外部表,这样当Hive中写入数据后,HBase中也会同时更新  2、MapReduce读取Hive数据,然后写入(API或者Bulkload)到HBase1、Hive外部表创

Hbase表两种数据备份方法

Hbase表两种数据备份方法导入和导出示例本文将提供两种备份方法——1)基于Hbase提供的类对hbase中某张表进行备份2)基于Hbasesnapshot数据快速备份方法场合:由于线上和测试环境是分离的,无法在测试环境访问线上库,所以需要将线上的hbase表导出一部分到测试环境中的hbase表,这就是本文的由来。

HBase四种部署模式和基本操作

本文主要包括两部分的内容,第一部分主要包HBase的四种安装方法,分别是:①单机版模式,②伪集群模式,③使用HBase自带的zookeeper构建分布式集群,④使用独立安装的zookeeper构建分布式集群。第二部分通过HBaseshell,展示HBase的基本操作,如创建表、插入记录、查询记录、删除记录等。HBase的部署方式包括:部署模