栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

hbase 多云在线迁移

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

hbase 多云在线迁移

背景,hbase 集群迁移时,以双写方案实现。相互同步。互为主备

一、修改host 

cluster A 和 cluster B 两个集群host 要全部添加。

cluster A host  10.40.0.138 10.40.0.153 10.40.0.99 老集群 uc 

cluster B host 10.41.0.89  10.41.0.90 10.41.1.185 10.41.1.186 10.41.2.237 新集群 ali 

二、add peer 

添加peers 

在ali 集群执行

add_peer 'alitouc',CLUSTER_KEY => '10.40.0.138,10.40.0.153,10.40.0.99:2181:/hbase'

在uc 集群执行

add_peer 'uctoali',CLUSTER_KEY => '10.41.1.185,10.41.1.186,10.41.2.237:2181:/hbase'

查看peers 

list_peers

创建测试表

create "test","A"

put 'test','r1','A','123'    添加数据。

scan 'test' 查看数据。

修改表复制属性

alter 'test',{NAME => 'A' , REPLICATION_SCOPE=>'1'}

三、全量同步

3.1 所有表全部修改为 REPLICATION_SCOPE=>'1' 

alter 'grp_msg_read_receipt',{NAME => 'cf' , REPLICATION_SCOPE=>'1'}

alter 'grp_msg_sender',{NAME => 'cf' , REPLICATION_SCOPE=>'1'}

alter 'msg_delivery_report',{NAME => 'cf' , REPLICATION_SCOPE=>'1'}

alter 'room_conversation',{NAME => 'cf' , REPLICATION_SCOPE=>'1'}

alter 'room_conversation_roomid_index',{NAME => 'cf' , REPLICATION_SCOPE=>'1'}

alter 'user_conversation',{NAME => 'cf' , REPLICATION_SCOPE=>'1'}

alter 'user_conversation_userid_index',{NAME => 'cf' , REPLICATION_SCOPE=>'1'}

alter 'user_conversation_userid_index',{NAME => 'cf' , REPLICATION_SCOPE=>'1'}

 

3.2 创建快照

查看当前已存在的 快照 list_snapshots

如果存在,删 除

delete_snapshot ‘test_snapshot’

创建快照:

snapshot 'test','test_snapshot'

复制快照:

hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -Dmapreduce.map.memory.mb=4096 -Dmapreduce.map.java.opts=-Xmx3686m -snapshot test_snapshot  -copy-to hdfs://10.41.0.89:8020/hbase -mappers 20 -overwrite

修改权限

 hdfs dfs -chmod -R 777 /hbase/.hbase-snapshot

 hdfs dfs -chmod -R 777 /hbase/archive

恢复快照:

restore_snapshot 'test_snapshot'

完成。

常用命令

删除测试表

先disable 再drop 

disable ‘test’

drop 'test'

禁用 peer 

disable_peer '1'

启用peer 

enable_peer 'ID'

usermod -s /bin/bash hbase 启用hbase 用户

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1021040.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号