You can delete a node from a cluster.
Delete Server
You can perform the Delete Server operation to delete a node from a cluster.
Sample statement for deleting a node:
ALTER SYSTEM DELETE SERVER 'ip:port' [,'ip:port'...] [ZONE [=] 'zone']
This statement can be executed only in the sys tenant.
Load balancing is involved when the Delete Server operation is performed. Resource units on the deleted OBServer node are migrated to another OBServer node in the same zone. Resource unit migration implements automatic balancing of resource units, which is controlled by the Root Service. After the resource units are migrated, the Delete Server operation succeeds.
However, during the balancing process, resources of other nodes in the same zone may be insufficient to accommodate the migrated resource units. As a result, the resource unit migration fails, and the node remains in the deleting state. You can check whether the resource unit migration fails in /home/admin/oceanbase/log/rootservice.log. The error code for migration failure is -4624. If the migration fails, you must perform the Cancel Delete Server operation, add a node to the zone to scale out the cluster, and then delete the target node. For more information about how to add a node to a zone to scale out a cluster, see Add an OBServer node to a zone.
Example:
Log on to the
systenant of the cluster as therootuser.Execute the following statement to delete the node.
Sample code:
obclient> ALTER SYSTEM DELETE SERVER "xx.xx.xx.xx:2882" zone='z1'Query the
oceanbase.DBA_OB_SERVERSview. If the node cannot be found in the list, the node is deleted.obclient> SELECT * FROM oceanbase.DBA_OB_SERVERS;
Cancel Delete Server
You can perform the Cancel Delete Server operation to cancel the Delete Server operation.
Sample statement:
obclient> ALTER SYSTEM CANCEL DELETE SERVER 'ip:port' [,'ip:port'...] [ZONE [=] 'zone']
This statement can be executed only in the sys tenant.
Example:
Log on to the
systenant of the cluster as therootuser.Execute the following statement to cancel the deletion of the node.
Sample code:
obclient> ALTER SYSTEM CANCEL DELETE SERVER '10.10.10.1:2882' zone='zone1';