Skip to content

Commit 3593288

Browse files
authored
HBASE-27803 Update ref guide about the changes of the replication storage related concepts (#5199)
Signed-off-by: Liangjun He <[email protected]>
1 parent a1f2b4e commit 3593288

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

src/main/asciidoc/_chapters/ops_mgt.adoc

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,6 +2292,33 @@ enable_table_replication <TABLE_NAME>::
22922292
Enable the table replication switch for all its column families. If the table is not found in the destination cluster then it will create one with the same name and column families.
22932293
disable_table_replication <TABLE_NAME>::
22942294
Disable the table replication switch for all its column families.
2295+
peer_modification_switch <enable_or_disable>, <drain_procedures>::
2296+
Enabled/Disable peer modification operations, such as adding/removing replication peers.
2297+
The second parameter means whether you want to wait until all existing peer modification
2298+
procedures to finish before returning when disabling peer modification.
2299+
peer_modification_enabled::
2300+
Check whether peer modification is enabled.
2301+
2302+
=== Migrate Across Different Replication Peer Storages
2303+
Starting from 2.6.0, we introduce a file system based `ReplicationPeerStorage`, which stores
2304+
the replication peer state with files on HFile file system, instead of znodes on ZooKeeper.
2305+
And we have also implemented a tool to copy replication peer state across different replication
2306+
peer storages.
2307+
[source,shell]
2308+
----
2309+
./bin/hbase copyreppeers <SRC_REPLICATION_PEER_STORAGE> <DST_REPLICATION_PEER_STORAGE>
2310+
----
2311+
To support doing the migrate online, we introduce a shell command called `peer_modification_switch`.
2312+
[source,ruby]
2313+
----
2314+
hbase> peer_modification_switch false, true
2315+
----
2316+
Use the above command can disable peer modification operations. The second `true` means you want to
2317+
wait until all the existing replication peer modification procedures to finish before returning.
2318+
After disabling the peer modification, it is safe for you to copy replication peer state with the
2319+
above tool, and then update all the _hbase-site.xml_ files in the cluster to specify the new
2320+
replication peer storage, and finally trigger an online configuration update to load the new
2321+
replication peer storage.
22952322

22962323
=== Serial Replication
22972324

@@ -2401,10 +2428,18 @@ This option was introduced in link:https://issues.apache.org/jira/browse/HBASE-1
24012428

24022429
==== Replication Internals
24032430

2431+
Replication State Storage::
2432+
In HBASE-15867, we abstract two interfaces for storing replication state,
2433+
`ReplicationPeerStorage` and `ReplicationQueueStorage`. The former one is for storing the
2434+
replication peer related states, and the latter one is for storing the replication queue related
2435+
states.
2436+
HBASE-15867 is only half done, as although we have abstract these two interfaces, we still only
2437+
have zookeeper based implementations.
2438+
24042439
Replication State in ZooKeeper::
2405-
HBase replication maintains its state in ZooKeeper.
24062440
By default, the state is contained in the base node _/hbase/replication_.
2407-
This node contains two child nodes, the `Peers` znode and the `RS` znode.
2441+
Usually this nodes contains two child nodes, the `peers` znode is for storing replication peer
2442+
state, and the `rs` znodes is for storing replication queue state.
24082443

24092444
The `Peers` Znode::
24102445
The `peers` znode is stored in _/hbase/replication/peers_ by default.
@@ -2419,6 +2454,15 @@ The `RS` Znode::
24192454
The child znode name is the region server's hostname, client port, and start code.
24202455
This list includes both live and dead region servers.
24212456

2457+
Other implementations for `ReplicationPeerStorage`::
2458+
Starting from 2.6.0, we introduce a file system based `ReplicationPeerStorage`, which stores
2459+
the replication peer state with files on HFile file system, instead of znodes on ZooKeeper.
2460+
The layout is almost the same with znodes on zookeeper, the main difference is that, the HFile
2461+
file system may not support atomic rename, so we use two files to store the state and when reading
2462+
we will read them both and compare the timestamp to find out the newer one. So typically, you will
2463+
see two peer config files. And for enable/disable state, we just touch a disabled file if the peer
2464+
is disabled, and remove the file when enabling the peer.
2465+
24222466
==== Choosing Region Servers to Replicate To
24232467

24242468
When a master cluster region server initiates a replication source to a slave cluster, it first connects to the slave's ZooKeeper ensemble using the provided cluster key . It then scans the _rs/_ directory to discover all the available sinks (region servers that are accepting incoming streams of edits to replicate) and randomly chooses a subset of them using a configured ratio which has a default value of 10%. For example, if a slave cluster has 150 machines, 15 will be chosen as potential recipient for edits that this master cluster region server sends.
@@ -2641,6 +2685,15 @@ The following metrics are exposed at the global region server level and at the p
26412685
| The number of region servers a given region server should attempt to
26422686
failover simultaneously.
26432687
| 1
2688+
2689+
| hbase.replication.peer.storage.impl
2690+
| The replication peer storage implementation
2691+
| zookeeper
2692+
2693+
| hbase.replication.peers.directory
2694+
| The directory for storing replication peer state, when filesystem replication
2695+
peer storage is specified
2696+
| peers
26442697
|===
26452698

26462699
=== Monitoring Replication Status

0 commit comments

Comments
 (0)