OBJECTIVE :
This post explains the procedure to implement hbase replication between two clusters.
SCENARIO:
Source cluster server hadoop215 ( HADOOP-INT) and destination cluster server hadoop220 (HADOOP-ANA). ( SSL disabled cluster to SSL enabled cluster).
PROCEDURE:
Step 1: Created the peers in below format in the source cluster server hadoop215 ( HADOOP-INT).
add_peer 'ID', 'CLUSTER_KEY'
CLUSTER_KEY Syntax:
<hbase.zookeeper.quorum>:<hbase.zookeeper.property.clientPort>:<zookeeper.znode.parent>
Note: The value for “zookeeper.znode.parent” can be obtained from "/etc/hbase/conf/hbase-site.xml" property. For unsecured cluster this value is “/hbase” and for secured cluster this value is “/hbase-unsecure”.
Example
To create a peer with peer id ‘2’ and to list
the peers.
From the hbase shell run the following command as below:
hbase(main)> add_peer '2', 'hadoop216,hadoop217,hadoop218:2181:/hbase'
hbase(main)> list_peers
Step 2: Create a test table ‘reptable4’ with REPLICATION_SCOPE => ‘1’ in source cluster
Step 3: Enable replication for table ‘reptable4’ in source cluster :
Useful
commands related to hbase replication:
- · To list the peers:
>list_peers
- · To create a column family with replication scope 1
>create 'reptable4', { NAME => 'cf1', REPLICATION_SCOPE => 1}
- · To describe a table
>describe 'reptable4'
- · To enable replication for a table:
>enable_table_replication 'reptable4’
- · To insert a row and value to a column
>put 'reptable4', 'row1', 'cf1:v2', 'bar'
- · To see the detailed schema for a table:
>scan 'reptable4'
- · To disable replication for a table:
>disable_table_replication 'reptable4’
- · To list replicated tables:
>list_replicated_tables
Reference link:
No comments:
Post a Comment
Note: only a member of this blog may post a comment.