If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can run this command to collect the diagnostic information of the specified OceanBase cluster, including the logs, host information, stack information, and performance information of the cluster.
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 all [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --from | No | string | Empty | The start time of log collection in the yyyy-mm-dd hh:mm:ss format. |
| --to | No | string | Empty | The end time of log collection in the yyyy-mm-dd hh:mm:ss format. |
| --since | No | string | Empty | The most recent period of time for log collection, in the format of <n> <m|h|d>, where n specifies the time value, m represents "minute", h represents "hour", and d represents "day". For example, 30m specifies to collect logs of the last 30 minutes. |
| --scope | No | string | all | The type of log of the OceanBase cluster to be collected. Valid values: observer, election, rootservice, and all. |
| --grep | No | string | Empty | The search keyword. |
| --encrypt | No | string | false | Specifies whether to encrypt the returned files. Valid values: true and false. |
| --store_dir | No | string | The current path where the command is executed | The local path where the results are stored. |
| --temp_dir | No | string | /tmp |
The directory where temporary files generated by the remote node during log collection 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. |
Examples
Method 1: Use the command out-of-the-box without a configuration file
Note
For more information about the parameters used in the command in this section, see Configure obdiag.
Collect the logs, stack information, and performance information of OceanBase Database, as well as logs and CPU and memory information of specified nodes.
Collect logs of the specified period
obdiag gather all --from "2022-07-28 16:25:00" --to "2022-07-28 18:30:00" --encrypt true \ --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \ --config obcluster.servers.nodes[1].ip=xx.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/oceanbaseThe output is as follows:
... ZipFileInfo: +------------------+-----------+ | Node | LogSize | +==================+===========+ | xxx.xxx.xxx.xxx | 29.874M | +------------------+-----------+ ... ZipFileInfo: +------------------+-----------+ | Node | LogSize | +==================+===========+ | xxx.xxx.xxx.xxx | 143.229M | +------------------+-----------+ ... ... # Collect logs of the specified period. Summary: +-------------------+-----------+----------+------------------+--------+----------------------------------------------------------------------------------------------+ | Node | Status | Size | Password | Time | PackPath | +===================+===========+==========+==================+========+==============================================================================================+ | xxx.xxx.xxx.xxx | Completed | 29.874M | fB7FrrzTGl4EK5Hl | 20 s | obdiag_gather_pack_20220729170718/result_xxx.xxx.xxx.xxx_20220729222724_20220730003224.zip | +-------------------+-----------+----------+------------------+--------+----------------------------------------------------------------------------------------------+ | xxx.xxx.xxx.xxx | Completed | 143.229M | SGRbXvMyA7lrnFW1 | 74 s | obdiag_gather_pack_20220729170718/result_xxx.xxx.xxx.xxx_20220729222724_20220730003224.zip | +-------------------+-----------+----------+------------------+--------+----------------------------------------------------------------------------------------------+ ... # Collect real-time information of the nodes where the observer process resides. Summary: +-------------------+-----------+---------+--------+--------------------------------------------------------------------------------+ | Node | Status | Size | Time | PackPath | +===================+===========+=========+========+================================================================================+ | xxx.xxx.xxx.xxx | Completed | 45.276K | 5 s | obdiag_gather_pack_20220729170856/os_info_xxx.xxx.xxx.xxx_20220729170856.zip | +-------------------+-----------+---------+--------+--------------------------------------------------------------------------------+ | xxx.xxx.xxx.xxx | Completed | 42.152K | 6 s | obdiag_gather_pack_20220729170856/os_info_xxx.xxx.xxx.xxx_20220729170856.zip | +-------------------+-----------+---------+--------+--------------------------------------------------------------------------------+ # Collect stack information of the observer process. Summary: +-------------------+-----------+---------+--------+---------------------------------------------------------------------------------+ | Node | Status | Size | Time | PackPath | +===================+===========+=========+========+=================================================================================+ | xxx.xxx.xxx.xxx | Completed | 22.693K | 13 s | obdiag_gather_pack_20220729170902/obstack2_xxx.xxx.xxx.xxx_20220729170902.zip | +-------------------+-----------+---------+--------+---------------------------------------------------------------------------------+ | xxx.xxx.xxx.xxx | Completed | 19.902K | 13 s | obdiag_gather_pack_20220729170902/obstack2_xxx.xxx.xxx.xxx_20220729170902.zip | +-------------------+-----------+---------+--------+---------------------------------------------------------------------------------+ Gather Perf Summary: +-------------------+-----------+----------+--------+-----------------------------------------------------------------------------+ | Node | Status | Size | Time | PackPath | +===================+===========+==========+========+=============================================================================+ | xxx.xxx.xxx.xxx | Completed | 368.178K | 90 s | obdiag_gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip | +-------------------+-----------+----------+--------+-----------------------------------------------------------------------------+ | xxx.xxx.xxx.xxx | Completed | 368.178K | 90 s | obdiag_gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip | +-------------------+-----------+----------+--------+-----------------------------------------------------------------------------+Collect logs of a recent period
# Collect logs of the last hour with the target nodes accessible to obdiag without a password. obdiag gather all --since 1h \ --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \ --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2 \ --config obcluster.servers.nodes[2].ip=xx.xx.xx.xx.3 \ --config obcluster.servers.global.home_path=/home/admin/oceanbase # Collect logs of the last 30 minutes with the target nodes accessible to obdiag without a password. obdiag gather all --since 30m \ --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \ --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2 \ --config obcluster.servers.nodes[2].ip=xx.xx.xx.xx.3 \ --config obcluster.servers.global.home_path=/home/admin/oceanbase # Collect logs of the last 30 minutes with the information on different ODP nodes varying. obdiag gather all --since 30m \ --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/test1/oceanbase \ --config obcluster.servers.nodes[1].ip=xx.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 # Collect logs of the last hour with the connection information of the `sys` tenant specified. In this case, obdiag automatically obtains the IP addresses of all nodes in the cluster. obdiag gather all --since 1h \ --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.ssh_username=test \ --config obcluster.servers.global.ssh_password=****** \ --config obcluster.servers.global.home_path=/home/admin/oceanbase
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.
Collect the performance reports, logs, stack information, and performance information of the specified OceanBase cluster, as well as logs and CPU and memory information of nodes in the cluster.
obdiag gather all --from "2022-07-28 16:25:00" --to "2022-07-28 18:30:00" --encrypt true
The output is as follows:
...
ZipFileInfo:
+------------------+-----------+
| Node | LogSize |
+==================+===========+
| xxx.xxx.xxx.xxx | 29.874M |
+------------------+-----------+
...
ZipFileInfo:
+------------------+-----------+
| Node | LogSize |
+==================+===========+
| xxx.xxx.xxx.xxx | 143.229M |
+------------------+-----------+
...
...
# Collect logs of the specified period.
Summary:
+-------------------+-----------+----------+------------------+--------+----------------------------------------------------------------------------------------------+
| Node | Status | Size | Password | Time | PackPath |
+===================+===========+==========+==================+========+==============================================================================================+
| xxx.xxx.xxx.xxx | Completed | 29.874M | fB7FrrzTGl4EK5Hl | 20 s | obdiag_gather_pack_20220729170718/result_xxx.xxx.xxx.xxx_20220729222724_20220730003224.zip |
+-------------------+-----------+----------+------------------+--------+----------------------------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 143.229M | SGRbXvMyA7lrnFW1 | 74 s | obdiag_gather_pack_20220729170718/result_xxx.xxx.xxx.xxx_20220729222724_20220730003224.zip |
+-------------------+-----------+----------+------------------+--------+----------------------------------------------------------------------------------------------+
...
# Collect real-time information of the nodes where the observer process resides.
Summary:
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+=========+========+================================================================================+
| xxx.xxx.xxx.xxx | Completed | 45.276K | 5 s | obdiag_gather_pack_20220729170856/os_info_xxx.xxx.xxx.xxx_20220729170856.zip |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 42.152K | 6 s | obdiag_gather_pack_20220729170856/os_info_xxx.xxx.xxx.xxx_20220729170856.zip |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------------+
# Collect stack information of the observer process.
Summary:
+-------------------+-----------+---------+--------+---------------------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+=========+========+=================================================================================+
| xxx.xxx.xxx.xxx | Completed | 22.693K | 13 s | obdiag_gather_pack_20220729170902/obstack2_xxx.xxx.xxx.xxx_20220729170902.zip |
+-------------------+-----------+---------+--------+---------------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 19.902K | 13 s | obdiag_gather_pack_20220729170902/obstack2_xxx.xxx.xxx.xxx_20220729170902.zip |
+-------------------+-----------+---------+--------+---------------------------------------------------------------------------------+
Gather Perf Summary:
+-------------------+-----------+----------+--------+-----------------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+==========+========+=============================================================================+
| xxx.xxx.xxx.xxx | Completed | 368.178K | 90 s | obdiag_gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip |
+-------------------+-----------+----------+--------+-----------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 368.178K | 90 s | obdiag_gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip |
+-------------------+-----------+----------+--------+-----------------------------------------------------------------------------+
# Collect logs of the last 2 hours.
obdiag gather all --since 2h
Results
The command generates a folder in the specified directory. A sample folder name is obdiag_gather_pack_20240808105846.