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 parameterENDPOINT_CLASSNAME
to define the custom replication endpoint. EitherCLUSTER_KEY
orENDPOINT_CLASSNAME
should be specified. IfENDPOINT_CLASSNAME
is defined, thenCLUSTER_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
andTABLE_CFS
parameters. But you can configure replication for all tables by setting theREPLICATE_ALL
flag via the set_peer_replicate_all command. -
Regardless of the
REPLICATE_ALL
flag value, only the tables with the set flagREPLICATION_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
andTABLE_CFS
are related. You can’t set tables from the namespaces that are already defined by theNAMESPACES
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[]>[,...]}]
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: |
state |
A replication peer state. Possible values are |
namespaces_array |
An array of strings specified in the format |
namespace_name |
A namespace name |
table_name |
A table name |
column_families_array |
An array of strings specified in the format |
class_name |
A name of the custom class. Mandatory in case of replication being configured for a custom replication endpoint. Example: |
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 |