This article applies to the scenario of independently deploying obdiag. Using obdiag gather clog will call ob_admin on the collection machine through the obdiag tool to parse the clog file and collect the clog in the selected time range with one click. Using obdiag gather slog will call ob_admin on the collection machine through the obdiag tool to parse the slog file and collect the slog in the selected time range with one click.
If it is a cluster deployed by obd, you can directly collect information on the selected cluster through the obd side diagnostic command group.
Instructions for use
obdiag gather clog
obdiag gather clog [options]
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --from | No | string | Default is empty | The start time of log collection, the format is: yyyy-mm-dd hh:mm:ss.
ExplanationIf the obdiag used is a version before V2.0.0, there is no need to add quotation marks when configuring this option, otherwise an error will be reported. V2.0.0 and later versions no longer limit whether to include quotes when configuring this option. |
| --to | No | string | Default is empty | The end time of log collection, the format is: yyyy-mm-dd hh:mm:ss.
ExplanationIf the obdiag used is a version before V2.0.0, there is no need to add quotation marks when configuring this option, otherwise an error will be reported. V2.0.0 and later versions no longer limit whether to include quotes when configuring this option. |
| --since | No | string | 30m |
Log collection for a recent period of time, the format is: <n><m|h|d>, where n represents the time number to be entered, m represents minutes, h represents hours, and d represents days, such as 30m represents the last 30 minutes. |
| --store_dir | No | string | Defaults to the current path where the command is executed | The local path where the results are stored. |
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag's own configuration. |
| --config | No | string | Default is empty | Configuration of the cluster to be diagnosed by obdiag, fixed style: --config key1=value1 --config key2=value2.
ExplanationThe parameters that support configuration through this option can be found in obdiag configuration. |
| --config_password | No | string | Default is empty | obdiag When using an encrypted configuration file, you need to pass in the corresponding password through this option.
ExplanationFor details, see Configuration file encryption. |
obdiag gather slog
obdiag gather slog [options]
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --from | No | string | Default is empty | The start time of log collection, the format is: yyyy-mm-dd hh:mm:ss. |
| --to | No | string | Default is empty | The end time of log collection, the format is: yyyy-mm-dd hh:mm:ss. |
| --since | No | string | 30m |
Log collection for a recent period of time, the format is: <n><m|h|d>, where n represents the time number to be entered, m represents minutes, h represents hours, and d represents days, such as 30m represents the last 30 minutes. |
| --store_dir | No | string | Defaults to the current path where the command is executed | The local path where the results are stored. |
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag's own configuration. |
| --config | No | string | Default is empty | Configuration of the cluster to be diagnosed by obdiag, fixed style: --config key1=value1 --config key2=value2.
ExplanationThe parameters that support configuration through this option can be found in obdiag configuration. |
Usage example
Method 1: Use without configuration file (out of the box)
- Collect clog logs
obdiag gather clog --from "2023-01-16 18:25:00" --to "2023-01-17 01:30:00" \
--config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
--config obcluster.servers.nodes[1].ip=xx.xx.xx.2 \
--config obcluster.servers.global.ssh_username=test \
--config obcluster.servers.global.ssh_password=****** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
The output is as follows:
Gather clog Summary:
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+=========+========+=======================================================================+
| xxx.xxx.xxx.xxx | Completed | 15.762K | 6 s | gather_pack_20230118002457/obadmin_xxx.xxx.xxx.xxx_20230118002458.zip |
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
```* Collect slog logs
```shell
obdiag gather slog --from "2023-01-16 18:25:00" --to "2023-01-17 01:30:00" \
--config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
--config obcluster.servers.nodes[1].ip=xx.xx.xx.2 \
--config obcluster.servers.global.ssh_username=test \
--config obcluster.servers.global.ssh_password=****** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
The output is as follows:
Gather slog Summary:
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+=========+========+=======================================================================+
| xxx.xxx.xxx.xxx | Completed | 15.762K | 6 s | gather_pack_20230118002457/obadmin_xxx.xxx.xxx.xxx_20230118002458.zip |
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
```* The collected nodes are configured with password-free settings
```bash
obdiag gather slog \
--config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
--config obcluster.servers.nodes[1].ip=xx.xx.xx.2 \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
```* The account and password for ssh login of the collected nodes are different.
```bash
obdiag gather slog \
--config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
--config obcluster.servers.nodes[0].ssh_username=test1 \
--config obcluster.servers.nodes[0].ssh_password=****** \
--config obcluster.servers.nodes[0].home_path=/home/test2/oceanbase
--config obcluster.servers.nodes[1].ip=xx.xx.xx.2
--config obcluster.servers.nodes[1].ssh_username=test2 \
--config obcluster.servers.nodes[1].ssh_password=****** \
--config obcluster.servers.nodes[1].home_path=/home/test2/oceanbase
```* Provide the connection information of the sys tenant and let obdiag automatically help you obtain the IP addresses of each node in the cluster and collect information about all nodes in the cluster.
```bash
obdiag gather slog \
--config db_host=xx.xx.xx.xx \
--config db_port=xxxx \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=*** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
Method 2: Use with configuration file
You need to ensure that the login information of the node to be collected has been configured in the obdiag configuration file config.yml. For related detailed configuration introduction, see obdiag configuration.
- Collect clog logs
obdiag gather clog --from "2023-01-16 18:25:00" --to "2023-01-17 01:30:00"
```* Collect slog logs
```shell
obdiag gather slog --from "2023-01-16 18:25:00" --to "2023-01-17 01:30:00"
