obd provides a set of tool commands that encapsulate some commonly used commands to enhance the developer experience.
You can use the -h/--help option in each command to view the help information of subcommands. Similarly, when an error occurs during command execution, you can use the -v/--verbose option to view the detailed execution process of the command.
obd devmode enable
You can run this command to enable developer mode. Developer mode is a prerequisite for using the tool command group. After developer mode is enabled, some errors will be downgraded, and obd will ignore invalid parameters. Non-kernel developers are advised to use this command with caution.
obd devmode enable
obd devmode disable
You can run this command to disable developer mode.
obd devmode disable
obd env show
You can run this command to view the environment variables of obd.
obd env show
You can specify a variable name to view the information of the specified variable. You can also specify the -A/--all option to view all environment variables, including system variables.
obd env set
You can run this command to set the environment variables of obd. These environment variables will affect the behavior of obd to some extent. We recommend that you do not use this command unless you have special requirements.
obd env set [key] [value]
The following table lists the environment variables that you can set.
Environment variable |
Value range |
Description |
|---|---|---|
| OBD_DISABLE_RSYNC | {0, 1} | Specifies whether to disable the rsync command. If this environment variable is set to 1, the rsync command is disabled. If this environment variable is set to 0, the rsync command is enabled. By default, obd uses the rsync command for remote transmission when the conditions are met. |
| OBD_DEV_MODE | {0, 1} | Specifies whether to enable developer mode. |
| TELEMETRY_MODE | {0, 1} | Specifies whether to enable the telemetry feature. |
| TELEMETRY_LOG_MODE | {0, 1} | Specifies whether to enable the telemetry data print feature. |
| IO_DEFAULT_CONFIRM | {0, 1} | Specifies whether to enable automatic confirmation. If this parameter is set to 1, obd automatically confirms all subsequent commands. Some obd commands require confirmation. |
| ENV_LOCK_MODE | {0, 1, 2} | Specifies the lock level. obd supports three types of locks: image repository lock, deployment configuration lock, and global lock. By default, obd obtains a global shared lock, a deployment configuration exclusive lock, and an image repository shared lock. When you run the obd mirror or obd cluster deploy command, obd changes the image repository shared lock to an image repository exclusive lock. The value of this variable can be 0, 1, or 2. The default value is 2. The following table describes the values.
|
| OBD_DISABLE_RSA_ALGORITHMS | {0, 1} | Specifies whether to disable the rsa-sha2-512 and rsa-sha2-256 algorithms for login. |
| OBD_INSTALL_PRE | N/A | Specifies the parent directory for obd installation. The default value is / (the root directory). |
| OBD_INSTALL_PATH | N/A | Specifies the installation directory of obd. If this environment variable is not set, obd automatically appends usr/obd/ to the value of OBD_INSTALL_PRE. |
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 the environment variables of obd. Use this command with caution.
obd env clear
obd tool command
You can run this command to execute some commonly used commands.
obd tool command <deploy name> <command> [options]
The following table lists the commands.
pid: View the pid of the service (non-interactive command)
ssh: Log in to the target server and go to the log directory (interactive command)
less: View the logs of the target service (interactive command)
gdb: Attach gdb to the template service (interactive command)
The following table describes the options.
Option |
Required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| -c/--components | No | string | If the command is an interactive command, the first component in the configuration file is selected by default. If the command is a non-interactive command, all components are used by default. | The name of the component to execute the command. Separate the names of multiple components with commas (,). |
| -s/--servers | No | string | If the command is an interactive command, the first node of the current component in the configuration file is selected by default. If the command is a non-interactive command, all available nodes are used by default. | The name of the node in the specified component. Separate the names of multiple nodes with commas (,). |
obd tool db_connect
You can run this command to establish a database connection.
obd tool db_connect <deploy name> [options]
The deploy name parameter specifies the deployment name, which can be considered an alias for the configuration file.
The following table describes the options.
Option |
Required |
Data Type |
Default Value |
Description |
|---|---|---|---|---|
| -c/--component | No | string | The first component in the configuration file is selected by default. | The name of the component to be connected. Valid values: obproxy, obproxy-ce, oceanbase, and oceanbase-ce. |
| -s/--server | No | string | The first node of the current component in the configuration file is selected by default. | The name of the node under the specified component. |
| -u/--user | No | string | root | The username used for the database connection. |
| -p/--password | No | string | Empty by default. | The password used for the database connection. |
| -t/--tenant | No | string | sys | The tenant used for the database connection. |
| -D/--database | No | string | Empty by default. | The name of the database used for the database connection. |
| --obclient-bin | No | string | obclient | The path of the OBClient binary file. |
obd tool list
You can run this command to view the tools installed by using obd.
obd tool list
obd tool install
You can run this command to install the required tool by using obd.
Note
Since V3.4.0, obd supports the global installation of obclient. You can directly use the obclient command. If you use an obd version earlier than V3.4.0, you must configure the environment variable for obclient after the installation is successful.
obd tool install <tool name> [options]
The tool name parameter specifies the name of the tool to be installed. Valid values: obclient, obdiag (which is equivalent to oceanbase-diagnostic-tool), obtpch, obtpcc, ob-sysbench, and openjdk-jre.
Note
Since V2.10.0, obd supports the installation of obtpch, obtpcc, ob-sysbench, and openjdk-jre by using this command.
The following table describes the options.
Option |
Required |
Data Type |
Default Value |
Description |
|---|---|---|---|---|
| -V/--version | No | string | The latest version is selected by default. | The version of the tool to be installed. |
| -p/--prefix | No | string | The home directory of the current user is selected by default. | The installation path of the tool to be installed. |
| -y/--assumeyes | No | bool | false | Specifies whether to automatically confirm the installation issues. |
| -f/--force | No | bool | false | Specifies whether to forcibly install the tool when conflicts occur. |
obd tool uninstall
You can run this command to uninstall a tool installed by using obd.
obd tool uninstall <tool name> [options]
The tool name parameter specifies the name of the tool to be uninstalled. Valid values: obclient, obdiag (oceanbase-diagnostic-tool), obtpch, obtpcc, ob-sysbench, and openjdk-jre.
Note
obd V2.10.0 and later allow you to run this command to uninstall obtpch, obtpcc, ob-sysbench, and openjdk-jre installed by using obd.
The following table describes the options.
Option |
Required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| -y/--assumeyes | No | bool | false | Specifies whether to automatically confirm the problems that occur during uninstallation. |
| -f/--force | No | bool | false | Specifies whether to forcibly uninstall the tool when a conflict occurs. |
obd tool update
You can run this command to upgrade a tool installed by using obd.
obd tool update <tool name> [options]
The tool name parameter specifies the name of the tool to be upgraded. Valid values: obclient, obdiag (oceanbase-diagnostic-tool), obtpch, obtpcc, ob-sysbench, and openjdk-jre.
Note
obd V2.10.0 and later allow you to run this command to upgrade obtpch, obtpcc, ob-sysbench, and openjdk-jre installed by using obd.
The following table describes the options.
Option |
Required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| -V/--version | No | string | The latest version by default. | The target version for the tool upgrade. |
| -p/--prefix | No | string | The installation path of the tool by default. | The installation path after the tool is upgraded. |
| -y/--assumeyes | No | bool | false | Specifies whether to automatically confirm the problems that occur during the upgrade. |
| -f/--force | No | bool | false | Specifies whether to forcibly upgrade the tool when a conflict occurs. |
obd display-trace
You can run this command to view the details of the log corresponding to the task ID. This helps you quickly locate the log.
obd display-trace <trace_id>
# example
obd display-trace 080b8ffc-9f7c-11ed-bec1-00163e030e58
The trace_id parameter specifies the task ID. After you run other obd commands, the corresponding task ID is output. The prompt also describes how to view the log. 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
