set_peer_replicate_all
Definition
Sets the REPLICATE_ALL flag to true or false for the specified replication relationship (peer). Remember the following restrictions:
-
Before setting the
REPLICATE_ALLflag totrue, clear the previously added namespaces and tables/column families from the replication peer configuration. Use the remove_peer_namespaces and remove_peer_tableCFs commands for this purpose. Otherwise you will receive errors. -
If the
REPLICATE_ALLflag istrue, then all user tables with theREPLICATION_SCOPEflag != 0 are replicated. But you can use the set_peer_exclude_namespaces and set_peer_exclude_tableCFs commands to exclude some namespaces and tables/column families from the replication process. -
Before setting the
REPLICATE_ALLflag tofalse, clear the previously excluded namespaces and tables/column families from the replication peer configuration. Use the set_peer_exclude_namespaces and set_peer_exclude_tableCFs commands with empty second parameter for this purpose. Otherwise you will receive errors. -
If the
REPLICATE_ALLflag isfalse, only the selected tables are replicated. To select replicable namespaces, use the set_peer_namespaces and append_peer_namespaces commands. To select replicable tables/column families, use set_peer_tableCFs and append_peer_tableCFs.
Usage
set_peer_replicate_all <flag_value>
| Parameter | Description |
|---|---|
flag_value |
A new value of the |
Examples
Setting true
hbase(main):039:0> list_peers
PEER_ID CLUSTER_KEY ENDPOINT_CLASSNAME STATE REPLICATE_ALL NAMESPACES TABLE_CFS BANDWIDTH
1 serov-adh-1.ru-central1.internal,serov-adh-2.ru-central1.internal,serov-adh-3.ru-central1.internal:2181:/hbase DISABLED false ns1;ns2 default.articles 0
1 row(s)
Took 0.0108 seconds
=> #<Java::JavaUtil::ArrayList:0x2633d09c>
hbase(main):040:0> set_peer_replicate_all '1', true
ERROR: java.io.IOException: Need clean namespaces or table-cfs config firstly when replicate_all flag is true
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:472)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:130)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:324)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:304)
Caused by: org.apache.hadoop.hbase.replication.ReplicationException: Need clean namespaces or table-cfs config firstly when replicate_all flag is true
at org.apache.hadoop.hbase.master.replication.ReplicationManager.checkPeerConfig(ReplicationManager.java:134)
at org.apache.hadoop.hbase.master.replication.ReplicationManager.updatePeerConfig(ReplicationManager.java:103)
at org.apache.hadoop.hbase.master.HMaster.updateReplicationPeerConfig(HMaster.java:3535)
at org.apache.hadoop.hbase.master.MasterRpcServices.updateReplicationPeerConfig(MasterRpcServices.java:1943)
at org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:413)
... 3 more
Set the replicate_all flag to true or false for the specified peer.
If replicate_all flag is true, then all user tables (REPLICATION_SCOPE != 0)
will be replicate to peer cluster. But you can use 'set_peer_exclude_namespaces'
to set which namespaces can't be replicated to peer cluster. And you can use
'set_peer_exclude_tableCFs' to set which tables can't be replicated to peer
cluster.
If replicate_all flag is false, then all user tables cannot be replicate to
peer cluster. Then you can use 'set_peer_namespaces' or 'append_peer_namespaces'
to set which namespaces will be replicated to peer cluster. And you can use
'set_peer_tableCFs' or 'append_peer_tableCFs' to set which tables will be
replicated to peer cluster.
Notice: When you want to change a peer's replicate_all flag from false to true,
you need clean the peer's NAMESPACES and TABLECFS config firstly.
When you want to change a peer's replicate_all flag from true to false,
you need clean the peer's EXCLUDE_NAMESPACES and EXCLUDE_TABLECFS
config firstly.
Examples:
# set replicate_all flag to true
hbase> set_peer_replicate_all '1', true
# set replicate_all flag to false
hbase> set_peer_replicate_all '1', false
Took 8.1956 seconds
hbase(main):042:0> remove_peer_namespaces '1', ['ns1', 'ns2']
Took 0.0100 seconds
hbase(main):043:0> remove_peer_tableCFs '1', {'articles' => []}
Took 0.0082 seconds
hbase(main):044:0> set_peer_replicate_all '1', true
Took 0.0081 seconds
hbase(main):045:0> list_peers
PEER_ID CLUSTER_KEY ENDPOINT_CLASSNAME STATE REPLICATE_ALL NAMESPACES TABLE_CFS BANDWIDTH
1 serov-adh-1.ru-central1.internal,serov-adh-2.ru-central1.internal,serov-adh-3.ru-central1.internal:2181:/hbase DISABLED true 0
1 row(s)
Took 0.0086 seconds
=> #<Java::JavaUtil::ArrayList:0x4f82248f>
Setting false
hbase(main):032:0> set_peer_replicate_all '1', false
ERROR: java.io.IOException: Need clean exclude-namespaces or exclude-table-cfs config firstly when replicate_all flag is false
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:472)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:130)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:324)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:304)
Caused by: org.apache.hadoop.hbase.replication.ReplicationException: Need clean exclude-namespaces or exclude-table-cfs config firstly when replicate_all flag is false
at org.apache.hadoop.hbase.master.replication.ReplicationManager.checkPeerConfig(ReplicationManager.java:144)
at org.apache.hadoop.hbase.master.replication.ReplicationManager.updatePeerConfig(ReplicationManager.java:103)
at org.apache.hadoop.hbase.master.HMaster.updateReplicationPeerConfig(HMaster.java:3535)
at org.apache.hadoop.hbase.master.MasterRpcServices.updateReplicationPeerConfig(MasterRpcServices.java:1943)
at org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:413)
... 3 more
Set the replicate_all flag to true or false for the specified peer.
If replicate_all flag is true, then all user tables (REPLICATION_SCOPE != 0)
will be replicate to peer cluster. But you can use 'set_peer_exclude_namespaces'
to set which namespaces can't be replicated to peer cluster. And you can use
'set_peer_exclude_tableCFs' to set which tables can't be replicated to peer
cluster.
If replicate_all flag is false, then all user tables cannot be replicate to
peer cluster. Then you can use 'set_peer_namespaces' or 'append_peer_namespaces'
to set which namespaces will be replicated to peer cluster. And you can use
'set_peer_tableCFs' or 'append_peer_tableCFs' to set which tables will be
replicated to peer cluster.
Notice: When you want to change a peer's replicate_all flag from false to true,
you need clean the peer's NAMESPACES and TABLECFS config firstly.
When you want to change a peer's replicate_all flag from true to false,
you need clean the peer's EXCLUDE_NAMESPACES and EXCLUDE_TABLECFS
config firstly.
Examples:
# set replicate_all flag to true
hbase> set_peer_replicate_all '1', true
# set replicate_all flag to false
hbase> set_peer_replicate_all '1', false
Took 8.6671 seconds
hbase(main):033:0> set_peer_exclude_tableCFs '1', {}
Took 0.0110 seconds
hbase(main):034:0> set_peer_exclude_namespaces '1', []
Took 0.0080 seconds
hbase(main):035:0> set_peer_replicate_all '1', false
Took 0.0077 seconds
hbase(main):036:0> list_peers
PEER_ID CLUSTER_KEY ENDPOINT_CLASSNAME STATE REPLICATE_ALL NAMESPACES TABLE_CFS BANDWIDTH
1 serov-adh-1.ru-central1.internal,serov-adh-2.ru-central1.internal,serov-adh-3.ru-central1.internal:2181:/hbase DISABLED false 0
1 row(s)
Took 0.0052 seconds
=> #<Java::JavaUtil::ArrayList:0x3909a854>