# Tool commands

OceanBase Deployer (OBD) provides a series of tool commands, including general commands that deliver a better experience for developers.

## 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.

```shell
obd devmode enable
```

## obd devmode disable

You can run this command to disable the developer mode.

```shell
obd devmode disable
```

## obd env show

You can run this command to display the environment variables of OBD.

```shell
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.

```shell
obd env set [key] [value]
```

You can set the following variables:

* `OBD_DISABLE_RSYNC`: OBD allows you to run the `rsync` command for remote data transmission when the prerequisites are met. If this environment variable is set to `1`, the `rsync` command is disabled. Valid values: `0` and `1`.

* `OBD_DEV_MODE`: specifies whether to enable the developer mode. Valid values: `0` and `1`.

## obd env unset

You can run this command to delete the specified environment variable.

```shell
obd env unset [key] [value]
```

## obd env clear

You can run this command to clear environment variables of OBD. Use this command with caution.

```shell
obd env clear
```

## obd tool command

You can use this command to run some general commands.

```shell
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.

```shell
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 run this command to display trace_id obd log。

```shell
obd display-trace <trace_id>
```

The `trace_id` parameter is the uuid for executing the command。