set_peer_namespaces

Definition

Sets all replicable namespaces for the specified replication relationship (peer). Remember the following restrictions:

  • The REPLICATE_ALL flag should have the false value in the replication peer configuration (see set_peer_replicate_all).

  • Setting a namespace means that all tables in this namespace with the REPLICATION_SCOPE flag != 0 are replicated. If the peer configuration already contains some table (added via append_peer_tableCFs or set_peer_tableCFs), then setting its namespace with this command is not allowed.

  • If you need to clear included namespaces, run the current command with an empty array as the second input parameter. You can also use the remove_peer_namespaces command.

CAUTION
This command removes the previously defined namespaces from the replication peer configuration (unlike append_peer_namespaces).

Usage

set_peer_namespaces '<peer_id>', <namespaces_array[]>
Arguments
Parameter Description

peer_id

A unique identifier of the replication peer. Should not contain hyphens

namespaces_array

An array of strings specified in the format '<namespace_name>', where <namespace_name> — a namespace name

Examples

Successful namespace setting

hbase(main):054: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;ns2 default.articles;default.table10;default.temp1:cf1 0
1 row(s)
Took 0.0090 seconds
=> #<Java::JavaUtil::ArrayList:0x51c008fd>
hbase(main):055:0> set_peer_namespaces '1', ['ns1']
Took 0.0130 seconds
hbase(main):056: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.0084 seconds
=> #<Java::JavaUtil::ArrayList:0x3c98981e>

Unsuccessful namespace setting

hbase(main):051: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.0081 seconds
=> #<Java::JavaUtil::ArrayList:0x126af200>
hbase(main):052:0> set_peer_namespaces '1', ['default']

ERROR: java.io.IOException: Table-cfs articles is conflict with namespaces default 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 articles is conflict with namespaces default 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 namespaces config for the specified peer.

  1. The replicate_all flag need to be false when set the replicable namespaces.
  2. Set a namespace in the peer config means that all tables in this namespace
     will be replicated to the peer cluster. If peer config already has a table,
     then not allow set this table's namespace to the peer config.

  Examples:

    # set namespaces config is null, then the table-cfs config decide
    # which table to be replicated.
    hbase> set_peer_namespaces '1', []
    # set namespaces to be replicable for a peer.
    # set a namespace in the peer config means that all tables in this
    # namespace (with replication_scope != 0 ) will be replicated.
    hbase> set_peer_namespaces '2', ["ns1", "ns2"]


Took 8.1730 seconds
Found a mistake? Seleсt text and press Ctrl+Enter to report it