This article is applicable to the scenario of independent deployment of obdiag, which can be used to collect the TopSQL information of the cluster with one click.
Description
This command collects SQL-related results and is often used to provide cluster information to forums or frontline support personnel when asking for help.
Instructions for use
obdiag gather scene run --scene=observer.topsql [options]
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --scene | Yes | string | Default is empty | Scene name, you can use the obdiag gather scene list command to check which scenes are supported by the current version. |
| --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. |
Usage example
Method 1: Use without configuration file (out of the box)
# Collect cluster TopSQL
obdiag gather scene run --scene=observer.topsql \
--config db_host=xx.xx.xx.xx \
--config db_port=xxxx \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=***
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 cluster TopSQL
obdiag gather scene run --scene=observer.topsql
Interpretation of results
After the command is executed, a folder will be generated in the specified directory. The folder is in the shape of: obdiag_gather_pack_20240808105846.
# tree
.
└── sql_result.txt # Cluster TopSQL result
Practical cases
Case: A user has a backup problem and needs to troubleshoot. Directly execute the following command to package the information required for diagnosis and send it to the community forum or frontline support personnel.
obdiag gather scene run --scene=observer.topsql \
--config db_host=xx.xx.xx.xx \
--config db_port=xxxx \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=***
