set_peer_tableCFs
Definition
Sets all replicable tables/column families for the replication relationship (peer). Remember the following restrictions:
-
The
REPLICATE_ALL
flag should have thefalse
value in the replication peer configuration (see set_peer_replicate_all). -
If the peer configuration already contains some namespace (added via append_peer_namespaces or set_peer_namespaces), then setting its tables with this command is not allowed.
-
If you need to clear included tables/column families, run the current command with an empty dictionary as the second input parameter. You can also use the remove_peer_tableCFs command.
CAUTION
This command removes the previously defined tables/column families from the replication peer configuration (unlike append_peer_tableCFs).
|
Usage
set_peer_tableCFs '<peer_id>',
{'[<namespace_name>:]<table_name>' => <column_families_array[]>[,...]}
Parameter | Description |
---|---|
peer_id |
A unique identifier of the replication peer. Should not contain hyphens |
namespace_name |
A namespace name |
table_name |
A table name |
column_families_array |
An array of strings specified in the format |
Examples
Successful table setting
hbase(main):060: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 ENABLED false ns1 default.articles;default.table10;default.temp1:cf1 0 1 row(s) Took 0.0089 seconds => #<Java::JavaUtil::ArrayList:0x572b4072> hbase(main):061:0> set_peer_tableCFs '1', {'articles' => []} Took 0.0147 seconds hbase(main):062: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 ENABLED false ns1 default.articles 0 1 row(s) Took 0.0079 seconds => #<Java::JavaUtil::ArrayList:0x53e166ad>
Unsuccessful table setting
hbase(main):055: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 default.articles 0 1 row(s) Took 0.0089 seconds => #<Java::JavaUtil::ArrayList:0x785d6a98> hbase(main):056:0> set_peer_tableCFs '1', {'ns1:temp2' => []} ERROR: java.io.IOException: Table-cfs ns1:temp2 is conflict with namespaces ns1 in peer config 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: Table-cfs ns1:temp2 is conflict with namespaces ns1 in peer config at org.apache.hadoop.hbase.master.replication.ReplicationManager.checkNamespacesAndTableCfsConfigConflict(ReplicationManager.java:181) at org.apache.hadoop.hbase.master.replication.ReplicationManager.checkPeerConfig(ReplicationManager.java:148) 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 replicable table-cf config for the specified peer. Note: 1. The replicate_all flag need to be false when set the replicable table-cfs. 2. Can't set a table to table-cfs config if it's namespace already was in namespaces config of this peer. Examples: # set table-cfs config is null, then the namespaces config decide which # table to be replicated. hbase> set_peer_tableCFs '1' # set table / table-cf to be replicable for a peer, for a table without # an explicit column-family list, all replicable column-families (with # replication_scope == 1) will be replicated hbase> set_peer_tableCFs '2', { "ns1:table1" => [], "ns2:table2" => ["cf1", "cf2"], "ns3:table3" => ["cfA", "cfB"]} Took 8.1736 seconds