Deleting a zone is typically used in scenarios such as cluster scale-down.
Prerequisites
Before deleting a zone, confirm the following:
Ensure no nodes exist in the zone. For operations related to viewing nodes within a zone, see View nodes.
Ensure the zone has been stopped.
The statement to stop a zone is as follows:
obclient [(none)]> ALTER SYSTEM STOP ZONE zone_name;Here,
zone_nameis the name of the zone to be stopped. Each statement only supports stopping one zone at a time.Example:
obclient [(none)]> ALTER SYSTEM STOP ZONE zone4;
Procedure
Log in to the
systenant of the cluster as therootuser.The connection example below is for reference only; please use your actual environment configurations when connecting to the database.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AFor more detailed instructions on connecting to a database, see Overview of database connections (MySQL-compatible mode) and Overview of database connections (Oracle-compatible mode).
Execute the following command to delete a zone from the cluster.
The statement is as follows:
obclient [(none)]> ALTER SYSTEM DELETE ZONE zone_name;Here,
zone_nameis the name of the zone to be deleted. Each statement only supports deleting one zone at a time. If you need to delete multiple zones, repeat this statement.Example: To delete
zone4from the cluster:obclient [(none)]> ALTER SYSTEM DELETE ZONE zone4;After the operation succeeds, you can query the
oceanbase.DBA_OB_ZONESview to confirm it.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 the zone is not in the query result, the zone was deleted successfully.
For more information about the
oceanbase.DBA_OB_ZONESview, see oceanbase.DBA_OB_ZONES.
References
For more information about zone-related O&M operations, see the following topics:
