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 in to the
systenant of the cluster as therootuser.Note that you must specify the corresponding options in the following sample code based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AFor more information about how to connect to a database, see Connection methods (MySQL mode) or Connection methods (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
zone4from 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.
References
For more zone-related O&M operations, see the following topics: