This topic describes how to clean up OceanBase Shell (obshell) nodes in an uninitialized cluster by using obshell-sdk-python. Once you clean up a node, its role changes to Single Agent and the node no longer belongs to any cluster. If you send the request on the node whose role is Master Agent, the roles of all nodes in the cluster become Single Agent.
Note
We recommend that you read Quick start for a better understanding of how to use obshell-sdk-python.
Considerations
Make sure that obshell runs normally.
Make sure that the node corresponding to the client instance that you use belongs to the cluster whose nodes are to be cleaned up.
Sample code
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance, with the IP address of "10.10.10.1" and the port number of 2886.
# Enter the root@sys password "****" for the cluster.
client = ClientSet("10.10.10.1", 2886, PasswordAuth("****"))
# Clean up the nodes in the cluster.
client.v1.agg_clear_uninitialized_agent()