Updated on 2024-10-08 GMT+08:00

Switching Between Active and Standby HBase Clusters

Scenario

The HBase cluster in the current environment is a DR cluster. Due to some reasons, the active and standby clusters need to be switched over. That is, the standby cluster becomes the active cluster, and the active cluster becomes the standby cluster.

This section applies to MRS 3.x or later.

Impact on the System

After the active and standby clusters are switched over, data cannot be written to the original active cluster, and the original standby cluster becomes the active cluster to take over upper-layer services.

Procedure

Ensuring that upper-layer services are stopped

  1. Ensure that the upper-layer services have been stopped. If not, perform operations by referring to Switching Between Active and DR HBase Clusters.

Disabling the write function of the active cluster

  1. Download and install the HBase client.

    For details, see Installing a Client (MRS 3.x or Later).

  2. On the HBase client of the standby cluster, run the following command as user hbase to disable the data write function of the standby cluster:

    kinit hbase

    hbase shell

    set_clusterState_standby

    The command is run successfully if the following information is displayed:

    hbase(main):001:0> set_clusterState_standby
    => true

Checking whether the active/standby synchronization is complete

  1. Run the following command to ensure that the current data has been synchronized (SizeOfLogQueue=0 and SizeOfLogToReplicate=0 are required). If the values are not 0, wait and run the following command repeatedly until the values are 0.

    status 'replication'

Disabling synchronization between the active and standby clusters

  1. Query all synchronization clusters and obtain the value of PEER_ID.

    list_peers

  2. Delete all synchronization clusters.

    remove_peer 'Standby cluster ID'

    Example:

    remove_peer '1'

  3. Query all synchronized tables.

    list_replicated_tables

  4. Disable all synchronized tables queried in the preceding step.

    disable_table_replication'Table name'

    Example:

    disable_table_replication 't1'

Performing an active/standby switchover

  1. Reconfigure HBase DR. For details, see Configuring HBase Active/Standby DR.