背景:假设有hbase1和hbase2两个集群,现在需要将hbase1的表迁移到hbase2,而且不能停止服务的运行。
准备工作
- 开启hbase.replication功能
设置hbase-site.xml中hbase.replication为true - 开启待复制集群的Yarn计算,后续拷贝数据基于MR
开始迁移
1.hbase2集群建表(click-count’在hbase1是已经存在的)
create table 'click-count','info'
2.建立两个集群的replication
在hbase1集群执行
hbase(main):002:0> alter 'click-count',{NAME=>'info', REPLICATION_SCOPE=>'1'}
Updating all regions with the new schema...
1/1 regions updated.
Done.
0 row(s) in 2.1320 seconds
hbase(main):003:0> add_peer '1',"172.16.201.7,172.16.201.8,172.16.201.9:2181:/hbase2"
0 row(s) in 0.0510 seconds
hbase(main):052:0> list_peers
PEER_ID CLUSTER_KEY STATE TABLE_CFS
1 172.16.201.7,172.16.201.8,172.16.201.9:2181:/hbase2 ENABLED
1 row(s) in 0.0080 seconds
3.暂停同步
在hbase1集群执行
hbase(main):052:0> disable_peer '1'
</