Enable the OCP multi-cluster mode

2025-01-10 06:15:54  Updated

This topic describes how to change standard OceanBase Cloud Platform (OCP) clusters into leader and follower OCP clusters in multi-cluster mode.

Applicability

This topic applies only to OceanBase Cloud Platform Enterprise Edition. OceanBase Cloud Platform Community Edition does not support the multi-cluster mode.

Prerequisites

OCP clusters of V3.1.1 or later versions have been installed.

Notice

The OceanBase clusters managed by the OCP clusters must have different names. Otherwise, follower OCP clusters cannot be registered with the leader OCP cluster.

Procedure

  1. Run the docker exec -it ocp bash command to enter the OCP container.

  2. Run the env | grep -i metadb command to check whether the following MetaDB environment variables are set:

    OCP_METADB_HOST
    OCP_METADB_PORT
    OCP_METADB_USER
    OCP_METADB_PASSWORD
    OCP_METADB_DBNAME
    

    If not, run the following commands to set the MetaDB environment variables:

    # The following sample variable settings are provided for your reference only. You need to change the values based on the actual situation. 
    export OCP_METADB_HOST="xxx.xxx.xxx.xxx"
    export OCP_METADB_PORT="2881"
    export OCP_METADB_USER="ocp@ocp_meta"
    export OCP_METADB_PASSWORD="******"
    export OCP_METADB_DBNAME="meta_01"
    
  3. Run the cd /home/admin/ocp-server/bin command to go to the directory where the ocp-bootstrap script is stored.

  4. Run the ./ocp-bootstrap -i command to enter the interaction mode.

  5. Perform one of the following steps to change an OCP cluster as needed:

    • Run the enableMc <OCP_CLUSTER_ID> <OCP_CLUSTER_NAME> <OCP_CLUSTER_ROLE> command in an OCP cluster to change it into the leader OCP cluster.

      ocp-bootstrap> enableMc 1 ocp1 LEADER
      
    • Run the following command in an OCP cluster to change it into a follower OCP cluster.

      ocp-bootstrap> enableMc 2 ocp2 FOLLOWER
      
    • After a failover, run the following command in the original leader OCP cluster to change it into an unregistered follower OCP cluster that can be registered with the new leader OCP cluster:

      ocp-bootstrap> unregisterMc
      
  6. Run the docker restart ocp command on the OCP host to restart OCP.

    If two or more OCP instances are deployed in the OCP cluster, restart all OCP instances.

Contact Us