OceanBase Deployer (OBD) provides a series of tool commands, including general commands that deliver a better experience for developers.
You can use the -h/--help option to view the help information of sub-commands. Similarly, you can also use -v/--verbose to view the detailed execution process of commands when the execution of sub commands reports an error.
obd devmode enable
You can run this command to enable the developer mode, which is a prerequisite for using other tool commands. After you enable the developer mode, OBD will downgrade the level of some exceptions and ignore some parameter exceptions. If you are not a kernel developer, use this command with caution.
obd devmode enable
obd devmode disable
You can run this command to disable the developer mode.
obd devmode disable
obd env show
You can run this command to display the environment variables of OBD.
obd env show
obd env set
You can run this command to set the environment variables of OBD. Environment variables can affect the performance of OBD. Therefore, we recommend that you use this command only when it is necessary.
obd env set [key] [value]
You can set the following variables:
OBD_DISABLE_RSYNC: OBD allows you to run thersynccommand for remote data transmission when the prerequisites are met. If this environment variable is set to1, thersynccommand is disabled. Valid values:0and1.OBD_DEV_MODE: specifies whether to enable the developer mode. Valid values:0and1.
obd env unset
You can run this command to delete the specified environment variable.
obd env unset [key] [value]
obd env clear
You can run this command to clear environment variables of OBD. Use this command with caution.
obd env clear
obd tool command
You can use this command to run some general commands.
obd tool command <deploy name> <command> [options]
Valid values of the command field:
pid: allows you to view the process ID (PID) of a service. This is a non-interactive command.ssh: allows you to log on to the specified server and enter the log directory. This is an interactive command.less: allows you to view the logs of the specified service. This is an interactive command.gdb: allows you to attach GNU Debugger (GDB) to a template service. This is an interactive command.
The following table describes the options of the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -c/--components | No | String | In an interactive command, the first component specified in the configuration file is used by default. In a non-interactive command, all components are used. | The name of the component on which the command is executed. Separate multiple component names with commas (,). |
| -s/--servers | No | String | In an interactive command, the first node of the current component specified in the configuration file is used by default. In a non-interactive command, all available nodes are used. | The name of the node under the specified component. Separate multiple node names with commas (,). |
obd tool db_connect
You can run this command to create a connection to the database.
obd tool db_connect <deploy name> [options]
The deploy name parameter indicates the name of the deployed cluster, which is also the alias of the configuration file.
The following table describes the options of the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -c or --component | No | String | By default, the first component specified in the configuration file is used. | The name of the component to be connected. Valid values: obproxy, obproxy-ce, oceanbase, and oceanbase-ce. |
| -s or --server | No | String | By default, the first node of the current component specified in the configuration file is used. | The name of the node under the specified component. |
| -u or --user | No | String | root | The username for connecting to the database. |
| -p or --password | No | String | Empty | The password for connecting to the database. |
| -t or --tenant | No | String | sys | The tenant for connecting to the database. |
| -D or --database | No | String | Empty | The name of the database to be connected. |
| --obclient-bin | No | String | obclient | The path to the directory where the binary files of OBClient are stored. |
obd display-trace
You can use this command to display the log details corresponding to the task ID, helping users quickly search for logs.
obd display-trace <trace_id>
# example
obd display-trace 080b8ffc-9f7c-11ed-bec1-00163e030e58
The trace_id parameter specifies the task ID. After executing other OBD commands, OBD will output the corresponding task ID and command prompts on how to view it. For example:
[admin@centos7 ~]$ obd cluster list
Local deploy is empty
Trace ID: a3cf9020-be42-11ed-b5b0-00163e030e58
If you want to view detailed obd logs, please run: obd display-trace a3cf9020-be42-11ed-b5b0-00163e030e58