obdiag gather variable

2025-11-28 06:05:02  Updated

If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can run this command to collect information about the variables of a cluster and store the information in a CSV file for variable comparison and archiving.

If your OceanBase cluster is deployed by using OceanBase Deployer (obd), you can run obdiag commands on obd to collect diagnostic information of the cluster. For more information about the commands, see obdiag commands.

Syntax

obdiag gather variable [options]

The following table describes the options.

Option Required? Data type Default value Description
--store_dir No string The current path where the command is executed The local path where the results are stored.
-c No string ~/.obdiag/config.yml The path of the configuration file.
--inner_config No string Empty The configurations of obdiag.
--config No string Empty The configurations of the cluster diagnosed by obdiag, in the format of --config key1=value1 --config key2=value2.

Note

For information about the parameters supported by this option, see Configure obdiag.

Examples

Method 1: Use the command out-of-the-box without a configuration file

obdiag gather variable \
    --config db_host=xx.xx.xx.xx \
    --config db_port=xxxx \
    --config tenant_sys.user=root@sys \
    --config tenant_sys.password=***

The output is as follows:

gather_variables start ...
Gather variables finished. For more details, please run cmd 'cat /home/admin/gather_variables/gather_variables/obcluster_variables_20240808144053.csv'
Trace ID: 28736940-5551-11ef-9ca9-a6e6206c49dc
If you want to view detailed obdiag logs, please run: obdiag display-trace 28736940-5551-11ef-9ca9-a6e6206c49dc

You can use the --store_dir option to specify the directory to store the collected information. For example, you can specify the /tmp directory:

obdiag gather variable --store_dir /tmp/ \
    --config db_host=xx.xx.xx.xx \
    --config db_port=xxxx \
    --config tenant_sys.user=root@sys \
    --config tenant_sys.password=***

Method 2: Use the command with a configuration file

Before you run the command, make sure that you have configured the logon information of the target nodes in the config.yml configuration file of obdiag. For more information, see Configure obdiag.

obdiag gather variable

The output is as follows:

gather_variables start ...
Gather variables finished. For more details, please run cmd 'cat /home/admin/gather_variables/gather_variables/obcluster_variables_20240808144053.csv'
Trace ID: 28736940-5551-11ef-9ca9-a6e6206c49dc
If you want to view detailed obdiag logs, please run: obdiag display-trace 28736940-5551-11ef-9ca9-a6e6206c49dc

You can use the --store_dir option to specify the directory to store the collected information. For example, you can specify the /tmp directory:

obdiag gather variable --store_dir /tmp/

You can use the -c option to specify the configuration file of the target cluster.

obdiag gather variable --store_dir -c test.yml

Results

The command generates a CSV file in the specified directory for variable comparison and archiving. A sample file path is ./gather_variables/obcluster_variables_20240808144053.csv.

Contact Us