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
You have logged in to the OceanBase Cloud Platform (OCP) console and been assigned the ADMIN role.
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
Run the
docker exec -it ocp bashcommand to enter the OCP container.Run the
env | grep -i metadbcommand to check whether the following MetaDB environment variables are set:OCP_METADB_HOST OCP_METADB_PORT OCP_METADB_USER OCP_METADB_PASSWORD OCP_METADB_DBNAMEIf 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"Run the
cd /home/admin/ocp-server/bincommand to go to the directory where theocp-bootstrapscript is stored.Run the
./ocp-bootstrap -icommand to enter the interaction mode.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 LEADERRun the following command in an OCP cluster to change it into a follower OCP cluster.
ocp-bootstrap> enableMc 2 ocp2 FOLLOWERAfter 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
Run the
docker restart ocpcommand on the OCP host to restart OCP.If two or more OCP instances are deployed in the OCP cluster, restart all OCP instances.