add_peer

Definition

Adds a new replication relationship (peer) between the current HBase cluster and either another HBase cluster or a custom replication endpoint, based on the predefined class. Remember the following features and restrictions:

  • To configure replication between two clusters, describe the second cluster using the input parameter CLUSTER_KEY. Otherwise use the parameter ENDPOINT_CLASSNAME to define the custom replication endpoint. Either CLUSTER_KEY or ENDPOINT_CLASSNAME should be specified. If ENDPOINT_CLASSNAME is defined, then CLUSTER_KEY is optional and should only be specified if a particular custom replication endpoint requires it.

  • By default, only the selected namespaces and tables are replicated. They should be defined by the NAMESPACES and TABLE_CFS parameters. But you can configure replication for all tables by setting the REPLICATE_ALL flag via the set_peer_replicate_all command.

  • Regardless of the REPLICATE_ALL flag value, only the tables with the set flag REPLICATION_SCOPE are replicated. To set this flag and make a table replicable, use the enable_table_replication command. To reset the flag and disable replication for a table, use the disable_table_replication command. Notice, that replication process can’t start for tables with disabled replication, even if these tables are selected in the peer configuration.

  • Input parameters NAMESPACES and TABLE_CFS are related. You can’t set tables from the namespaces that are already defined by the NAMESPACES parameter.

  • You can set replication peer namespaces later via the append_peer_namespaces or set_peer_namespaces commands. To remove namespaces, run the remove_peer_namespaces command.

  • You can set replication peer tables/column families later via the append_peer_tableCFs or set_peer_tableCFs commands. To remove tables/column families, run the remove_peer_tableCFs command.

NOTE
For more details on configuring replication, refer to the HBase documentation.

Usage

  • HBase clusters peer:

    add_peer '<peer_id>',
             CLUSTER_KEY => '<cluster_key>'[,
             STATE => '<state>'][,
             NAMESPACES => <namespaces_array[]>][,
             TABLE_CFS => {'[<namespace_name>:]<table_name>' => <column_families_array[]>[,...]}]
  • Custom replication endpoint:

    add_peer '<peer_id>',
             ENDPOINT_CLASSNAME => '<class_name>'[,
             CLUSTER_KEY => '<cluster_key>'][,
             STATE => '<state>'][,
             DATA => {'<key_name>' => <key_value>, [...]}][,
             CONFIG => {'<config_name>' => '<config_value>', [...]}][,
             NAMESPACES => <namespaces_array[]>][,
             TABLE_CFS => {'[<namespace_name>:]<table_name>' => <column_families_array[]>[,...]}]
Arguments
Parameter Description

peer_id

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

cluster_key

A full address of the second HBase cluster in the replication relationship. Mandatory in case of replication being configured between two clusters. Takes the following format: <hbase.zookeeper.quorum>:<hbase.zookeeper.property.clientPort>:<zookeeper.znode.parent>. All arguments can be obtained via Master UI (page HBase configuration)

state

A replication peer state. Possible values are ENABLED and DISABLED. The default value is ENABLED. Can be changed later via the disable_peer and enable_peer commands

namespaces_array

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

namespace_name

A namespace name

table_name

A table name

column_families_array

An array of strings specified in the format '<column_family>', where <column_family> — a column family name

class_name

A name of the custom class. Mandatory in case of replication being configured for a custom replication endpoint. Example: org.apache.hadoop.hbase.MyReplicationEndpoint

key_name

A name of the peer data parameter

key_value

A value of the peer data parameter

config_name

A name of the peer configuration parameter

config_value

A value of the peer configuration parameter

Examples

HBase clusters peer

hbase(main):001:0> add_peer '1', CLUSTER_KEY => "serov-adh-1.ru-central1.internal,serov-adh-2.ru-central1.internal,serov-adh-3.ru-central1.internal:2181:/hbase", TABLE_CFS => { "articles" => []}
Took 0.3667 seconds

Custom replication endpoint

hbase(main):018:0> add_peer '2', ENDPOINT_CLASSNAME => 'test', STATE => 'DISABLED', DATA => {'key1' => 'value1'}, CONFIG => {'config1' => 'value1'}, NAMESPACES => ['ns1'], TABLE_CFS => { "articles" => []}
Took 0.0306 seconds
Found a mistake? Seleсt text and press Ctrl+Enter to report it