4.tools-commands.md 4.5 KB
Newer Older
F
v1.6.0  
frf12 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
# 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.  |