OceanBase Diagnostic Tool (obdiag) is a command-line diagnostic tool for OceanBase Database. obdiag can scan, collect, and analyze logs, SQL audit records, and process stack traces of OceanBase Database. It can be used to perform one-click diagnostics on OceanBase clusters deployed in different modes, such as OCP, obd, or manually deployed by users. obdiag is open source. For more information, see obdiag GitHub repository.
obd integrates obdiag and allows you to perform one-click diagnostics by running the obd obdiag command. After you run the obd tool install obdiag command to install obdiag, you can use it. The options that you need to configure when you run the obd obdiag command are the same as those for obdiag. The difference is that you need to add the obd field before the obdiag field and specify the cluster deployment name in the command. You can run the obd cluster list command to view the cluster deployment names. The Name column in the output indicates the cluster deployment name. For example, you can run the obd obdiag rca run <deploy_name> command.
Note
The obd obdiag command can be used only to operate on clusters managed by obd. By default, clusters deployed by obd are managed by obd. You can take over non-obd-deployed clusters. For more information, see Take over a cluster by using obd.
Examples
Note
This topic describes only some simple operations. For more examples, see Diagnose a cluster.
Install obdiag.
obd tool install obdiag source ~/oceanbase-diagnostic-tool/init.shView the list of clusters managed by obd.
obd cluster listThe output is as follows:
+------------------------------------------------------------------+ | Cluster List | +-------------+----------------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +-------------+----------------------------------+-----------------+ | obtest | /home/admin/.obd/cluster/obtest | running | | demo | /home/admin/.obd/cluster/demo | running | +-------------+----------------------------------+-----------------+Collect cluster logs.
The following example collects logs of the
obtestcluster in the last 30 minutes and searches for the keywordSTORAGEin the observer logs.obd obdiag gather log obtest --since=30m --scope observer --grep STORAGEThe output is as follows:
Open ssh connection ok obdiag version: 3.6.0 gather_log start ... gather log from_time: 2025-08-07 17:00:16, to_time: 2025-08-07 17:31:16 gather start ok +-----------------------------------------------------------------------------------------------------------------------------------------------------------+ | Gather observer Log Summary on 2025-08-07 17:30:17 | +------------+---------+--------+---------------------------------------------------------------------------------------------------------------------------+ | Node | Status | Size | info | +------------+---------+--------+---------------------------------------------------------------------------------------------------------------------------+ | 10.10.10.2 | Success | 3.389M | file save in ./obdiag_gather_pack_20250807173016/observer_log_local_20250807170016_20250807173116_696697_pid_11453.tar.gz | +------------+---------+--------+---------------------------------------------------------------------------------------------------------------------------+ For result details, please run cmd ' cat ./obdiag_gather_pack_20250807173016/result_summary.txt ' Trace ID: 2096447e-7371-11f0-8219-00163e56c732 If you want to view detailed obdiag logs, please run: /home/admin/.obd/repository/oceanbase-diagnostic-tool/3.6.0/3dc41c5f31647397b7cf32c50af1b7508a84bf3e/ obdiag display-trace 2096447e-7371-11f0-8219-00163e56c732 See **OceanBase Deployer error codes** . Trace ID: 1ff1ff90-7371-11f0-a5b3-00163e56c732 If you want to view detailed obd logs, please run: obd display-trace 1ff1ff90-7371-11f0-a5b3-00163e56c732
