This article applies to the scenario of independently deploying obdiag. Use the obdiag gather all command to collect diagnostic information of the OceanBase cluster to which it belongs in one click, including collecting OceanBase cluster logs, host information, OceanBase cluster stack information, and OceanBase cluster perf information.
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 all [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 |
Logs are collected over a recent period of time, in the format: <n><m|h|d>, where n is a number, m represents minutes, h represents hours, and d represents days. For example, 30m represents the collection of the last 30 minutes. |
| --grep | No | string | Default is empty | Select keywords for query. |
| --store_dir | No | string | Defaults to the current path where the command is executed | The local path where the results are stored. |
| --temp_dir | No | string | /tmp |
The temporary file storage directory generated by the remote node during the log collection process |
| -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)
Quickly collect OceanBase database logs, host logs, host CPU/memory information, OceanBase database stack information, and flame graphs.
- Collect logs for a specified period of time
obdiag gather all --from "2022-07-28 16:25:00" --to "2022-07-28 18: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:
...
ZipFileInfo:
+------------------+-----------+
| Node | LogSize |
+==================+===========+
| xxx.xxx.xxx.xxx | 29.874M |
+------------------+-----------+
...
ZipFileInfo:
+------------------+-----------+
| Node | LogSize |
+==================+===========+
| xxx.xxx.xxx.xxx | 143.229M |
+------------------+-----------+
...
...
# Collect logs in the given time range
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 |
+-------------------+-----------+----------+------------------+--------+----------------------------------------------------------------------------------------------+
...
# Host metrics on observer nodes at current time
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 |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------------+
# Current observer stack snapshots
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 |
+-------------------+-----------+----------+--------+-----------------------------------------------------------------------------+
```* Quickly collect logs from the most recent period:
```shell
# Passwordless SSH: collect last 1h of logs
obdiag gather all --since 1h \
--config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
--config obcluster.servers.nodes[1].ip=xx.xx.xx.2 \
--config obcluster.servers.nodes[2].ip=xx.xx.xx.3 \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
# Passwordless SSH: collect last 30m of logs
obdiag gather all --since 30m \
--config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
--config obcluster.servers.nodes[1].ip=xx.xx.xx.2 \
--config obcluster.servers.nodes[2].ip=xx.xx.xx.3 \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
# When observer nodes differ: collect last 30m of logs
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.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 sys tenant connection; obdiag resolves nodes; collect last 1h of logs
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 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.
Quickly collect recent cluster performance reports, observer logs, host logs, host CPU/memory information, observer stack information, and flame graphs.
obdiag gather all --from "2022-07-28 16:25:00" --to "2022-07-28 18:30:00"
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 in the given time range
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 |
+-------------------+-----------+----------+------------------+--------+----------------------------------------------------------------------------------------------+
...
# Host metrics on observer nodes at current time
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 |
+-------------------+-----------+---------+--------+--------------------------------------------------------------------------------+
# Current observer stack snapshots
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 last 2 hours of data
obdiag gather all --since 2h
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.
