If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can use obdiag gather commands to collect diagnostic information of OceanBase Database.
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.
Prerequisites
A Zip tool is installed on the target nodes whose information is to be collected.
Syntax of gather commands
obdiag gather <gather type> [options]
Valid values of the gather type parameter are as follows:
log: collects logs of the specified OceanBase cluster.sysstat: collects information about nodes in the specified OceanBase cluster.clog: collects the clogs of the specified OceanBase cluster.slog: collects the slogs of the specified OceanBase cluster.plan_monitor: collects the execution details of parallel SQL statements with the specified trace ID in the specified OceanBase cluster.stack: collects the stack information of the specified OceanBase cluster.perf: collects the performance information of the specified OceanBase cluster.obproxy_log: collects the logs of the OceanBase Database Proxy (ODP) on which the specified OceanBase cluster depends.all: collects the diagnostic information of the specified OceanBase cluster, including the logs, node information, stack information, and performance information of the cluster.
obdiag gather log
You can run this command to collect logs of the specified OceanBase cluster.
Note
Before you use this 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 log [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --from | No | String | This option is left empty by default. | The start time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 12:00:00. |
| --to | No | String | This option is left empty by default. | The end time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 13:00:00. |
| --since | No | String | This option is left empty by default. | The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes. |
| --scope | No | String | all | The type of logs to be collected. Valid values: observer, election, rootservice, and all. |
| --grep | No | String | This option is left empty by default. | The search keyword. |
| --encrypt | No | String | false | Specifies whether to encrypt the returned files. Valid values: true and false. |
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here is an example:
obdiag gather log --scope observer --from 2022-06-30 16:25:00 --to 2022-06-30 18:30:00 --grep STORAGE --encrypt true
...
ZipFileInfo:
+-------------------+-----------+
| Node | LogSize |
+===================+===========+
| xxx.xxx.xxx.xxx | 36.184M |
+-------------------+-----------+
...
ZipFileInfo:
+-------------------+-----------+
| Node | LogSize |
+===================+===========+
| xxx.xxx.xxx.xxx | 44.176M |
+-------------------+-----------+
...
Summary:
+-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------+
| Node | Status | Size | Password | Time | PackPath |
+===================+===========+==========+==================+========+========================================================================+
| xxx.xxx.xxx.xxx | Completed | 36.762M | HYmVourcUyRNP8Om | 19 s | gather_pack_20220701183246/result_xxx.xxx.xxx.xxx_20220701183247.zip |
+-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 638.200M | 1RicMaiLUUNfemnj | 718 s | gather_pack_20220701183246/result_xxx.xxx.xxx.xxx_20220701183918.zip |
+-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------+
Notice
If encryption is enabled, collected logs are encrypted when being compressed. The value in the Password column indicates the password for decrypting the .zip package. Encryption is disabled by default.
Here are examples of collecting logs of a recent period.
# Collect logs of the last hour. obdiag gather log --since 1h # Collect logs of the last 30 minutes. obdiag gather log --since 30m # Collect logs of the last 30 minutes and specify the configuration file. obdiag gather log --since 30m -c /root/config.yml
obdiag gather sysstat
You can run this command to collect information about hosts in the specified OceanBase cluster, such as the dmesg, CPU, and memory information of the hosts.
Note
Before you use this 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 sysstat [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here is an example:
Example: obdiag gather sysstat
The sample result is as follows:
Summary:
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+=========+========+=========================================================================+
| xxx.xxx.xxx.xxx | Completed | 45.209K | 5 s | gather_pack_20220729164233/sysstat_xxx.xxx.xxx.xxx_20220729164233.zip |
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 42.170K | 5 s | gather_pack_20220729164233/sysstat_xxx.xxx.xxx.xxx_20220729164233.zip |
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
obdiag gather clog
You can run the obdiag gather clog command to call the ob_admin tool on the target server to parse clog files and collect clogs within the specified time range.
Note
Before you use this 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 clog [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --from | No | String | This option is left empty by default. | The start time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 12:00:00. |
| --to | No | String | This option is left empty by default. | The end time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 13:00:00. |
| --since | No | String | This option is left empty by default. | The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes. |
| --encrypt | No | String | false | Specifies whether to encrypt the returned files. Valid values: true and false. |
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here is an example:
obdiag gather clog --from 2023-01-16 18:25:00 --to 2023-01-17 01:30:00
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 |
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
obdiag gather slog
You can run the obdiag gather slog command to call the ob_admin tool on the target server to parse slog files and collect slogs within the specified time range.
Description
Before you use this 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 slog [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --from | No | String | This option is left empty by default. | The start time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 12:00:00. |
| --to | No | String | This option is left empty by default. | The end time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 13:00:00. |
| --since | No | String | This option is left empty by default. | The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes. |
| --encrypt | No | String | false | Specifies whether to encrypt the returned files. Valid values: true and false. |
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here is an example:
obdiag gather slog --from 2023-01-16 18:25:00 --to 2023-01-17 01:30:00
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 |
+-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
obdiag gather plan_monitor
You can run this command to collect the execution details of parallel SQL statements with the specified trace ID in the specified OceanBase cluster. In this way, you can analyze the operators if the SQL statement execution is slow during analytical processing (AP).
Note
- This command is supported only in OceanBase Database V3.0 and later.
- Before you use this command, make sure that the connection information of the target cluster has been configured in the
config.ymlconfiguration file of obdiag. For more information, see Configure obdiag.
obdiag gather plan_monitor [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --trace_id | Yes | String | This option is left empty by default. | In OceanBase Database of a version earlier than V4.0.0, you can query the gv$sql_audit view for the trace IDs. In OceanBase Database V4.0.0 and later, you can query the gv$ob_sql_audit view for the trace IDs. |
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here is an example:
obdiag gather plan_monitor --trace_id YB420BA2D99B-0005EBBFC45D5A00-0-0
Gather ob_admin Summary:
+-----------+--------+----------------------------------------------------------------------+
| Status | Time | PackPath |
+===========+========+======================================================================+
| Completed | 6 s | gather_pack_20230118002457 |
+-----------+--------+----------------------------------------------------------------------+
obdiag gather stack
You can run this command to collect the stack information of the specified OceanBase cluster. This command is not supported for a cluster built in the ARM architecture.
Note
Before you use this 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 stack [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here is an example:
Example: obdiag gather stack
The sample result is as follows:
Summary:
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+=========+========+==========================================================================+
| xxx.xxx.xxx.xxx | Completed | 19.926K | 10 s | gather_pack_20220729163951/obstack2_xxx.xxx.xxx.xxx_20220729163951.zip |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 22.803K | 12 s | gather_pack_20220729163951/obstack2_xxx.xxx.xxx.xxx_20220729163951.zip |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
obdiag gather perf
You can run this command to collect the performance information of the specified OceanBase cluster.
Note
Before you use this 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 perf [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --scope | No | String | all | The type of performance information to be collected. Valid values: sample, flame, pstack, and all. |
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here is an example:
obdiag gather perf
Gather Perf Summary:
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+==========+========+======================================================================+
| xxx.xxx.xxx.xxx | Completed | 368.178K | 90 s | gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip |
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 368.178K | 90 s | gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip |
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
obdiag gather obproxy_log
You can run this command to collect logs of the ODP on which the specified OceanBase cluster depends.
Note
Before you use this 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 obproxy_log [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --from | No | String | This option is left empty by default. | The start time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 12:00:00. |
| --to | No | String | This option is left empty by default. | The end time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 13:00:00. |
| --since | No | String | This option is left empty by default. | The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes. |
| --scope | No | String | all | The type of ODP logs to collect. Valid values: obproxy, obproxy_digest, obproxy_stat, obproxy_slow, obproxy_limit, and all. |
| --grep | No | String | This option is left empty by default. | The search keyword. |
| --encrypt | No | String | false | Specifies whether to encrypt the returned files. Valid values: true and false. |
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here is an example:
obdiag gather obproxy_log --scope obproxy --from 2022-06-25 10:25:00 --to 2022-06-25 18:30:00 --encrypt true
...
ZipFileInfo:
+------------------+-----------+
| Node | LogSize |
+==================+===========+
| xxx.xxx.xxx.xxx | 36.184M |
+------------------+-----------+
...
ZipFileInfo:
+-------------------+-----------+
| Node | LogSize |
+===================+===========+
| xxx.xxx.xxx.xxx | 44.176M |
+-------------------+-----------+
...
Gather ObProxy Log Summary:
+-------------------+-----------+----------+------------------+--------+-----------------------------------------------------------------------------+
| Node | Status | Size | Password | Time | PackPath |
+===================+===========+==========+==================+========+=============================================================================+
| xxx.xxx.xxx.xxx | Completed | 36.762M | HYmVourcUyRNP8Om | 19 s | gather_pack_20220701183246/obproxy_log_xxx.xxx.xxx.xxx_20220701183247.zip |
+-------------------+-----------+----------+------------------+--------+-----------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 638.200M | 1RicMaiLUUNfemnj | 718 s | gather_pack_20220701183246/obproxy_log_xxx.xxx.xxx.xxx_20220701183918.zip |
+-------------------+-----------+----------+------------------+--------+-----------------------------------------------------------------------------+
obdiag gather all
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.
Note
Before you use this 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 all [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --from | No | String | This option is left empty by default. | The start time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 12:00:00. |
| --to | No | String | This option is left empty by default. | The end time of log collection in the yyyy-mm-dd hh:mm:ss format. For example, 1970-01-01 13:00:00. |
| --since | No | String | This option is left empty by default. | The most recent period for which logs are collected, in the \<n> <m\|h\|d> format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to collect logs of the last 30 minutes. |
| --scope | No | String | all | The type of logs of the OceanBase cluster to be collected. Valid values: observer, election, rootservice, and all. |
| --grep | No | String | This option is left empty by default. | The search keyword. |
| --encrypt | No | String | false | Specifies whether to encrypt the returned files. Valid values: true and false. |
| --store_dir | No | String | The default path is the current path in which the command is executed. | The local path where the results are stored. |
| -c | No | String | ~/.obdiag/config.yml |
The path of the configuration file. |
Here are some examples:
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 hosts in the cluster.
obdiag gather all --from 2022-07-28 16:25:00 --to 2022-07-28 18:30:00 --encrypt true
...
ZipFileInfo:
+------------------+-----------+
| Node | LogSize |
+==================+===========+
| xxx.xxx.xxx.xxx | 29.874M |
+------------------+-----------+
...
ZipFileInfo:
+------------------+-----------+
| Node | LogSize |
+==================+===========+
| xxx.xxx.xxx.xxx | 143.229M |
+------------------+-----------+
...
...
# Logs of the specified period
Summary:
+-------------------+-----------+----------+------------------+--------+---------------------------------------------------------------------------------------+
| Node | Status | Size | Password | Time | PackPath |
+===================+===========+==========+==================+========+=======================================================================================+
| xxx.xxx.xxx.xxx | Completed | 29.874M | fB7FrrzTGl4EK5Hl | 20 s | gather_pack_20220729170718/result_xxx.xxx.xxx.xxx_20220729222724_20220730003224.zip |
+-------------------+-----------+----------+------------------+--------+---------------------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 143.229M | SGRbXvMyA7lrnFW1 | 74 s | gather_pack_20220729170718/result_xxx.xxx.xxx.xxx_20220729222724_20220730003224.zip |
+-------------------+-----------+----------+------------------+--------+---------------------------------------------------------------------------------------+
...
# Real-time information of the hosts where the observer process resides
Summary:
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+=========+========+=========================================================================+
| xxx.xxx.xxx.xxx | Completed | 45.276K | 5 s | gather_pack_20220729170856/os_info_xxx.xxx.xxx.xxx_20220729170856.zip |
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 42.152K | 6 s | gather_pack_20220729170856/os_info_xxx.xxx.xxx.xxx_20220729170856.zip |
+-------------------+-----------+---------+--------+-------------------------------------------------------------------------+
# Stack information of the observer process
Summary:
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
| Node | Status | Size | Time | PackPath |
+===================+===========+=========+========+==========================================================================+
| xxx.xxx.xxx.xxx | Completed | 22.693K | 13 s | gather_pack_20220729170902/obstack2_xxx.xxx.xxx.xxx_20220729170902.zip |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 19.902K | 13 s | 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 | gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip |
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
| xxx.xxx.xxx.xxx | Completed | 368.178K | 90 s | gather_pack_20230117140836/perf_xxx.xxx.xxx.xxx_20230117140836.zip |
+-------------------+-----------+----------+--------+----------------------------------------------------------------------+
# Collect logs of the last 2 hours.
obdiag gather all --since 2h