This topic describes how to set OBServer node parameters for an uninitialized OceanBase cluster by using obshell-sdk-python.
Note
We recommend that you read Quick start for a better understanding of how to use obshell-sdk-python.
Considerations
Make sure that OceanBase Shell (obshell) runs normally.
Make sure that the node corresponding to the client instance that you use belongs to the uninitialized cluster.
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("****"))
configs = {
"datafile_size": "24G", "log_disk_size": "24G",
"cpu_count": "16", "memory_limit": "16G", "system_memory": "8G",
"enable_syslog_recycle": "true", "enable_syslog_wf": "true"}
# Set the configurations of all OBServer node parameters in the cluster to configs.
client.v1.config_observer_sync(configs, "GLOBAL", [])
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("****"))
configs = {
"datafile_size": "24G", "log_disk_size": "24G",
"cpu_count": "16", "memory_limit": "16G", "system_memory": "8G",
"enable_syslog_recycle": "true", "enable_syslog_wf": "true"}
# Set the configurations of all OBServer node parameters in the cluster to configs.
dag = client.v1.config_observer(configs, "GLOBAL", [])
# Wait for the task to complete.
client.v1.wait_dag_succeed(dag.generic_id)
References
For more information about the API operation, see SetServerConfig.
For more information about how to call the API operation by using obshell-sdk-go, see Set server-level configurations.