日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Hbase复制(Replication )

發布時間:2024/9/27 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Hbase复制(Replication ) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Hbase復制使用手冊

1 Hbase復制簡介

通過hbase的replication功能實現集群間的相互復制.

2 環境

這里hbase版本為hbase-0.98.6-cdh5.3.3

3 配置

各個集群里配置hbase-site.xml里的復制功能:

<property>

<name>hbase.replication</name>

<value>true</value>

</property>

完整配置文件附錄:

<configuration>

<property>

??? <name>hbase.master</name>

??? <value>shenl:6000</value>

</property>

<property>

??? <name>hbase.master.maxclockskew</name>

??? <value>180000</value>

</property>

<property>

??? <name>hbase.rootdir</name>

??? <value>hdfs://shenl:8020/hbase</value>

</property>

<property>

??? <name>hbase.cluster.distributed</name>

??? <value>true</value>

</property>

<property>

??? <name>hbase.zookeeper.quorum</name>

??? <value>shenl</value>

</property>

<property>

??? <name>hbase.zookeeper.property.dataDir</name>

??? <value>/root/zookeeper/data</value>

</property>

<property>

??? <name>dfs.replication</name>

??? <value>1</value>

</property>

<property>

<name>hbase.replication</name>

<value>true</value>

</property>

</configuration>


?

4 使用

3.1 場景1:主節點同名表同步到各從節點

1 主節點里創建student表,指定有score和course兩個列族

create 'student', 'score', 'course'

put 'student', 'xiapi001','score:english', '10'

put 'student', 'xiapi002','score:chinese', '20'

put 'student','xiapi002','course:chinese', '001'

scan 'scores'

2打開主節點里表student的復制特性

disable 'student'

alter 'student', {NAME => 'score',REPLICATION_SCOPE => '1'},{NAME => 'course', REPLICATION_SCOPE => '1'}

enable 'student'

3主節點里添加要復制的從節點的peer

add_peer '10','192.168.56.103:2181:/hbase'

set_peer_tableCFs '10','student'

?

4從節點里新增跟主節點一樣的表

create 'student', 'score', 'course'

5主節點里新增數據到從節點里觀察數據是否同步

1)? 主節點里新增數據

?

2)? 從節點里查看數據

?

:1 這里數據同步是從replication功能打開之后,之前的數據需要手工同步.

2同步時可以指定列族,如僅同步student的score列族:

從節點里:

?

6同理添加peer,重復動作 34 5,即可實現場景1.

add_peer '11','192.168.56.104:2181:/hbase'

set_peer_tableCFs '10','student'

3.2場景2:主節點不同表同步到不同集群相應表

實現方式類似3.1,通過set_peer_tableCFs設置

set_peer_tableCFs '4', "slave1:grade; scores:grade"

set_peer_tableCFs '5', "slave2:grade; scores:grade"

list_peers

3.3場景3:各主節點表同步到同從集群相應表

實現方式:

主集群1里增加peer,主集群2里增加peer,同時通過set_peer_tableCFs設置需要同步的表即可.

#主hbase1 peers:

?

#主hbase2 peers :

add_peer '6','192.168.56.103:2181:/hbase'

set_peer_tableCFs '5', " master2:grade"

?

3.4復制命令詳解

Group name: replication

命令

官網解釋

中文意思

add_peer

adds a replication relationship between two clusters

為兩個集群添加復制管理

disable_peer

Disable a replication relationship

禁用復制關系

enable_peer

Enable a previously-disabled replication relationship

啟用復制關系

list_peers

list all replication relationships known by this cluster

顯示當前集群的復制關系

remove_peer

Disable and remove a replication relationship

禁用并刪除復制關系

list_replicated_tables

List all the tables and column families replicated from this cluster

顯示一個hbase集群下處于復制狀態的表

set_peer_tableCFs

Set the replicable table-cf config for the specified peer

設置peer下的表、列族復制關系

show_peer_tableCFs

Show replicable table-cf config for the specified peer.

顯示peer下表、列族復制關系

5 問題總結

1 驗證是需要先核對下hbase的版本,不同版本的復制命令不同

2 同步是針對配置后復制的新數據,舊數據需要手動遷移

總結

以上是生活随笔為你收集整理的Hbase复制(Replication )的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。