You can start or stop a zone by using SQL statements or in the OceanBase Cloud Platform (OCP) console.
You can start or stop a zone in a cluster to allow all physical servers in the zone to provide services externally or prevent them from providing services externally.
Start or stop a zone by using an SQL statement
Sample statement:
ALTER SYSTEM {START|STOP|FORCE STOP} ZONE zone_name;
Note:
This statement can be executed only in the
systenant.zone_namespecifies the name of the target zone. This statement starts or stops only one zone at a time.STOP ZONEandFORCE STOP ZoneThe
STOP ZONEstatement actively stops a zone.When this statement is executed, the system checks whether the logs of data replicas in all partitions are synchronized and whether the majority of replicas are online. The statement succeeds only when both conditions are met.
The
FORCE STOP Zonestatement force stops a zone.When this statement is executed, the system does not check whether the logs of data replicas in all partitions are synchronized but only checks whether the majority of replicas are online. The statement succeeds if the majority of replicas are online.
For example,
Start
zone1in the cluster.obclient> ALTER SYSTEM START ZONE zone1;Stop
zone1in the cluster.obclient> ALTER SYSTEM STOP ZONE zone1;Forcibly stop
zone1in the cluster.obclient> ALTER SYSTEM FORCE STOP ZONE Zone1;
Stop a zone in the OCP console
To stop an active zone in the OCP console, perform the ALTER SYSTEM STOP ZONE operation and then stop all observer processes in the zone.
Prerequisites
The target cluster can be managed in the current OCP cluster.
If the cluster has not been added to OCP, request the administrator to add the cluster. For more information, see the Take over a cluster topic in the OCP User Guide of the corresponding version.
You have the permissions to manage the cluster.
If you do not have the permissions to manage the cluster, request the administrator to assign the required role. For more information, see the Edit a user topic in the OCP User Guide of the corresponding version.
The majority of replicas are online. Otherwise, the operation will fail.
Note
An OceanBase cluster must meet the requirement for the majority of replicas. For example, if a primary zone is specified for a three-replica cluster, the region where the primary zone is located must have at least two zones and at least two full-featured replicas, with one replica for each zone. During disaster recovery of a three-replica cluster, the remaining two replicas are still in the majority. During disaster recovery of a five-replica cluster, the majority must contain at least three replicas.
Procedure
Log on to the OCP console.
The Clusters page automatically appears.
In the Clusters list, find the target cluster and click its name.
In the Zones list, find the row that contains the target zone, and click Stop in the Actions column.
In the confirmation dialog box, click Stop.