This topic describes the cluster commands of OceanBase Shell (OBShell). You can use the cluster commands of OBShell to deploy and manage OceanBase clusters in a production environment.
obshell cluster join
You can run this command before the initialization of an OceanBase cluster to add the current OBServer node to the cluster.
${home_path}/bin/obshell cluster join -z -s [-d] [-r] [-P] [-p] [-o]
# example
${home_path}/bin/obshell cluster join -z zone1 -s xxx.xxx.1
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -z, --zonename | Yes | string | None | The zone in which the current node resides. |
| -s, --observer | Yes | string | None | The IP address and port number of the node that you want to add. Specify the value in the ip:port format. The port number is optional. By default, port 2886 is used. |
| -d, --data_dir | No | string | ${home_path}/store | The directory for storing SSTable files and other data. By default, the store directory under the working directory is used. The working directory is specified by the home_path parameter. |
| -r, --redo_dir | No | string | ${data_dir} | The directory for storing clogs. By default, the value of this option is the same as that of the data_dir option. |
| -p, --mysql_port | No | string | 2881 | The port number for the SQL service protocol. By default, port 2881 is used. |
| -P, --rpc_port | No | string | 2882 | The protocol port number for remote access. By default, port 2882 is used. |
| -o, --optstr | No | String | None | Other options for OBServer nodes. You must specify each option in the key=value format, and separate multiple options with commas (,). The entire value string of the -o option must be enclosed by single quotation marks ('). Example: -o 'memory_limit=16G,system_memory=8G,log_disk_size=24G,datafile_size=24G'. |
obshell cluster remove
You can run this command before the initialization of an OceanBase cluster to remove the OBServer node where OBShell is stored from the cluster.
${home_path}/bin/obshell cluster remove -s
# example
${home_path}/bin/obshell cluster remove -s xxx.xxx.1
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -s, --observer | Yes | string | None | The IP address and port number of the node that you want to remove. Specify the value in the ip:port format. The port number is optional. By default, port 2886 is used. |
obshell cluster init
You can run this command to initialize an OceanBase cluster.
${home_path}/bin/obshell cluster init -n --rp [-i] [-d] [-r] [-P] [-p] [-o] [--rs]
# example
${home_path}/bin/obshell cluster init -n ob-test --rp 123456
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -n, --appname | Yes | string | None | The name of the OceanBase cluster. |
| --rp, --rootpassword | Yes | string | None | The password of the root user of the sys tenant. |
| -i, --clusterid | No | int | 1 | The ID of the OceanBase cluster. Default value: 1. |
| -d, --data_dir | No | string | ${home_path}/store | The directory for storing SSTable files and other data. By default, the store directory under the working directory is used. The working directory is specified by the home_path parameter. |
| -r, --redo_dir | No | string | ${data_dir} | The directory for storing clogs. By default, the value of this option is the same as that of the data_dir option. |
| -p, --mysql_port | No | int | 2881 | The port number for the SQL service protocol. By default, port 2881 is used. |
| -P, --rpc_port | No | int | 2882 | The protocol port number for remote access. By default, port 2882 is used. |
| --rs, --rs_list | No | string | The list of RootService servers. By default, the RootService server of a zone is the first server specified by the zone parameter. You must specify the information of each RootService server in the observer_ip:rpc_port:mysql_port format, and separate the information of multiple root servers with semicolons (;). The entire value string of the --rs option must be enclosed by single quotation marks ('). Example: --rs 'xx.xxx.xx.x1:2882:2881;xx.xxx.xx.x2:2882:2881'. |
|
| -o, --optstr | No | String | None | Other options for OBServer nodes. You must specify each option in the key=value format, and separate multiple options with commas (,). The entire value string of the -o option must be enclosed by single quotation marks ('). Example: -o 'memory_limit=16G,system_memory=8G,log_disk_size=24G,datafile_size=24G'. |
obshell cluster show
You can run this command to view the information of the current OceanBase cluster.
${home_path}/bin/obshell cluster show
If you run this command before the OceanBase cluster is initialized, the following information of OBShell is displayed: IP address, version, and port number. If you run this command after the OceanBase cluster is initialized, the information of OBShell and the following information of each OBServer node is displayed: cluster, version, zone, SQL port number, server port number, RootService server, and status.
The status of an OBServer node is described as follows:
- ACTIVE: The heartbeat connection between the OBServer node and the RootService server is normal.
- INACTIVE: The OBServer node lost the heartbeat connection with the RootService server.
- DELETING: The OBServer node is being deleted.
- STOPPED: The OBServer node is stopped.
For more information about status, see oceanbase.DBA_OB_SERVERS.
obshell cluster start
You can run this command to start the specified OBServer nodes. The OceanBase cluster of the specified OBServer nodes must be managed by OBShell. For information about how to determine whether an OceanBase cluster is managed by OBShell and the corresponding operations, see Emergency O&M.
${home_path}/bin/obshell cluster start [-a] [-s] [-z] [-i]
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description | |||
|---|---|---|---|---|---|---|---|
| -a, --all | No | None | Specifies to start all OBServer nodes. You do not need to set a value for this option. | By default, if you do not specify a flag, only the current OBServer node is started. | |||
| -s, --observer | No | string | None | The information of each OBShell-managed OBServer node to be started in the obshell_ip:obshell_port format. You must separate the information of multiple OBServer nodes with commas (,). Example: -s x.x.x.x:2886,x.x.x.x:2886. |
|||
| -z, --zonename | No | string | None | Specifies to start all OBServer nodes contained in the specified one or more zones. You must separate the names of multiple zones with commas (,). Example: -z zone1,zone2. |
|||
| -i, --id | No | string | None | The ID of the preceding task that starts or stops the specified OBServer nodes. You can use this option in special circumstances. When a cluster O&M task is locked by one or more preceding tasks, you can specify the -i option to release the previous tasks. Example: -i 22130706433028869. |
obshell cluster stop
You can run this command to stop the specified OBServer nodes.
${home_path}/bin/obshell cluster stop [-a] [-s] [-z] [-i]
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -f, --force | No | bool | false | The value true specifies to kill the observer process. The value false specifies to stop the server. For more information, see Isolate a node. |
| -a, --all | No | None | Specifies to stop all OBServer nodes. You do not need to set a value for this option. | |
| -s, --observer | No | string | None | The information of each OBShell-managed OBServer node to be stopped in the obshell_ip:obshell_port format. You must separate the information of multiple OBServer nodes with commas (,). Example: -s x.x.x.x:2886,x.x.x.x:2886. |
| -z, --zonename | No | string | None | Specifies to stop all OBServer nodes contained in the specified one or mroe zones. You must separate the names of multiple zones with commas (,). Example: -z zone1,zone2. |
| -i, --id | No | string | None | The ID of the preceding task that starts or stops the specified OBServer nodes. You can use this option in special circumstances. When a cluster O&M task is locked by one or more preceding tasks, you can specify the -i option to release the previous tasks. Example: -i 22130706433028869. |
obshell cluster upgrade
You can run this command to upgrade OceanBase Database or OBShell to the specified version.
${home_path}/bin/obshell upgrade -l [-m] [-p] [-y]
# example
${home_path}/bin/obshell cluster upgrade -l /home/oceanbase/upgrade/
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -l, --pkg-location | Yes | string | None | The path where the file package is located. |
| -p, --upg-pkg | No | string | None | The target version in the ${name}-${build_version} format. You must separate the information of multiple versions with commas (,). |
| -y, --yes | No | None | Specifies whether to cancel the secondary confirmation. You do not need to set a value for this option. | |
| -m, --upg-model | No | string | rolling | The upgrade mode of OceanBase Database. Valid values: stopService and rolling. |
obshell cluster scale-out
You can run this command to scale out a cluster by adding the current OBServer node to the cluster.
${home_path}/bin/obshell cluster scale-out -z -s [-d] [-r] [-P] [-p] [-o]
# example
${home_path}/bin/obshell cluster scale-out -z zone1 -s xxx.xxx.1:2886
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -s, --observer-addr | No | string | None | The IP address and port number of an existing OBServer node in the target cluster. You must specify the value in the ip:port format. The port number is optional. By default, port 2886 is used. |
| -z, --zonename | No | string | None | The zone to which the current OBServer node belongs. |
| -d, --data_dir | No | string | ${home_path}/store | The directory for storing SSTable files and other data. By default, the store directory under the working directory is used. The working directory is specified by the home_path parameter. |
| -r, --redo_dir | No | string | ${data_dir} | The directory for storing clogs. By default, the value of this option is the same as that of the data_dir option. |
| -p, --mysql_port | No | int | 2881 | The port number for the SQL service protocol. By default, port 2881 is used. |
| -P, --rpc_port | No | int | 2882 | The protocol port number for remote access. By default, port 2882 is used. |
| -o, --optstr | No | String | None | Other options for OBServer nodes. You must specify each option in the key=value format, and separate multiple options with commas (,). The entire value string of the -o option must be enclosed by single quotation marks ('). Example: -o 'memory_limit=16G,system_memory=8G,log_disk_size=24G,datafile_size=24G'. |