You can delete a zone to scale in a cluster.
Prerequisites
Before you delete a zone, make sure that:
The zone contains no nodes. For more information about how to view the nodes in a zone, see View a node.
The zone is stopped.
You can execute the following statement to stop a zone.
obclient [(none)]> ALTER SYSTEM STOP ZONE zone_name;In the statement,
zone_namespecifies the name of the zone to be stopped. This statement stops only one zone at a time.Here is an example:
obclient [(none)]> ALTER SYSTEM STOP ZONE zone4;
Procedure
Log on to the
systenant of the cluster as therootuser.Run the following command to log on. You must replace the related information in the command based on the actual database environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys -p***** -AFor more information about how to connect to OceanBase Database, see Overview of the Connect to OceanBase Database chapter in Develop Applications in MySQL Mode and Overview of the Connect to OceanBase Database chapter in Develop Applications in Oracle Mode.
Execute the following statement to delete a zone from a cluster.
obclient [(none)]> ALTER SYSTEM DELETE ZONE zone_name;In the statement,
zone_namespecifies the name of the zone to be deleted. This statement deletes only one zone at a time. To delete multiple zones, execute this statement repeatedly.For example, to delete a zone named zone4 from the cluster, execute the following statement:
obclient [(none)]> ALTER SYSTEM DELETE ZONE zone4;After the statement is executed, you can query the
oceanbase.DBA_OB_ZONESview to verify whether the zone is deleted.obclient [(none)]> SELECT * FROM oceanbase.DBA_OB_ZONES; +-------+----------------------------+----------------------------+--------+-----+----------+-----------+ | ZONE | CREATE_TIME | MODIFY_TIME | STATUS | IDC | REGION | TYPE | +-------+----------------------------+----------------------------+--------+-----+----------+-----------+ | zone1 | 2022-12-20 17:50:17.168745 | 2022-12-20 17:50:40.801054 | ACTIVE | HZ0 | hangzhou | ReadWrite | | zone2 | 2022-12-20 17:50:17.168745 | 2022-12-20 17:50:40.809504 | ACTIVE | HZ0 | hangzhou | ReadWrite | | zone3 | 2022-12-20 17:50:17.169804 | 2022-12-20 17:50:40.815833 | ACTIVE | SH0 | shanghai | ReadWrite | +-------+----------------------------+----------------------------+--------+-----+----------+-----------+ 3 rows in setIf this zone does not appear in the query result, the zone is successfully deleted.
For more information about the
oceanbase.DBA_OB_ZONESview, see oceanbase.DBA_OB_ZONES.
More information
For more zone-related O&M operations, see the following topics: