OceanBase诊断调优 (三) ——敏捷诊断工具obdiag一键收集诊断信息实践

2024年 5月 7日 70.1k 0

最近总结一些诊断OCeanBase的一些经验,出一个【OceanBase诊断调优】专题,也欢迎大家贡献自己的诊断OceanBase的方法。

1. 前言

obdiag定位为OceanBase敏捷诊断工具。整体使用上备以下的特点:

  • 部署简单:提供rpm包和OBD上部署的模式,均可一键部署安装,可以选择部署到任意一台能连接到集群各个节点的上,并不局限于OBServer节点。
  • 集中式收集:单点部署,无需每台服务器部署。使用的时候只需要在部署机器上执行收集或分析命令即可;

2. 安装部署使用

2.1. 独立安装使用obdiag

2.1.1. obdiag下载

obdiag工具可从OceanBase官网下载免费下载,下载链接

2.1.2. obdiag下载

使用文档参见链接

2.2. OBD模式下安装使用obdiag

如果你的OceanBase集群是通过OBD安装部署的,并且OBD的版本大于2.5.0那么,你可以直接通过下面的方式使用。

2.1.1. 安装

  1. 安装OBD 2.5.0 及以上版本
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
sudo yum install -y ob-deploy
source /etc/profile.d/obd.sh
  1. 安装obdiag工具

使用该命令可部署obdiag工具可在本机安装部署obdiag, (如果用户不安装直接使用也会走自动安装流程)

obdiag deploy

2.1.2. 使用

2.1.2.1. obd obdiag gather

使用该命令可调用obdiag工具进行OceanBase相关的诊断信息收集

obd obdiag gather <deploy name> <gather type>  [options]

gather type包含:

  • log:一键收集所属OceanBase集群的日志
  • sysstat:一键收集所属OceanBase集群主机信息
  • clog:一键收集所属OceanBase集群(clog日志)
  • slog:一键收集所属OceanBase集群(slog日志)
  • plan_monitor:一键收集所属OceanBase集群指定trace_id的并行SQL的执行详情信息
  • perf:一键收集所属OceanBase集群的perf信息(扁鹊图、perf火焰图、pstack火焰图)
  • obproxy_log:一键收集所属OceanBase集群所依赖的obproxy组件的日志
  • all:一键统一收集所属OceanBase集群的诊断信息,包括收集OceanBase日志/主机信息/OceanBase堆栈信息/OceanBase OceanBase perf信息(扁鹊图、perf火焰图、pstack火焰图)

3. obdiag独立部署模式下使用体验

1. 部署安装

在线部署(可访问外网的情况下可选择)

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
sudo yum install -y oceanbase-diagnostic-tool
source /usr/local/oceanbase-diagnostic-tool/init.sh

2. 收集最近半小时内的OB集群日志

$obdiag gather log --since 30m

...

ZipFileInfo:
+----------------+-----------+
| Node           | LogSize   |
+================+===========+
| 11.162.218.126 | 12.231M   |
+----------------+-----------+

...

Gather Ob Log Summary:
+----------------+-----------+---------+--------+-----------------------------------------------------------------------------------------------------------+
| Node           | Status    | Size    | Time   | PackPath                                                                                                  |
+================+===========+=========+========+===========================================================================================================+
| 11.162.218.126 | Completed | 12.231M | 5 s    | /home/test/gather_pack_20231103110502/ob_log_192.168.1.111_20231103103500_20231103110600.zip.             |
+----------------+-----------+---------+--------+-----------------------------------------------------------------------------------------------------------+
If you want to view detailed obdiag logs, please run:'obdiag display-trace --trace_id c5ca9bce-0279-3977-bb52-3ae0b35cd3a8'

Trace ID: c5f1e526-79f5-11ee-81e3-00163e01c7ce
If you want to view detailed obd logs, please run: obd display-trace c5f1e526-79f5-11ee-81e3-00163e01c7ce

3. 收集all

$obdiag gather all

...

ZipFileInfo:
+----------------+-----------+
| Node           | LogSize   |
+================+===========+
| 11.162.218.126 | 17.469M   |
+----------------+-----------+

...

Gather Ob Log Summary:
+----------------+-----------+---------+--------+-----------------------------------------------------------------------------------------------------------+
| Node           | Status    | Size    | Time   | PackPath                                                                                                  |
+================+===========+=========+========+===========================================================================================================+
| 11.162.218.126 | Completed | 17.469M | 6 s    | /home/test/gather_pack_20231103111342/ob_log_192.168.1.111_20231103104340_20231103111440.zip              |
+----------------+-----------+---------+--------+-----------------------------------------------------------------------------------------------------------+

... 

Gather Sysstat Summary:
+----------------+-----------+----------+--------+---------------------------------------------------------------------------------------------+
| Node           | Status    | Size     | Time   | PackPath                                                                                    |
+================+===========+==========+========+=============================================================================================+
| 11.162.218.126 | Completed | 865.705K | 2 s    | /home/test/gather_pack_20231103111342/sysstat_192.168.1.111_20231103111348.zip              |
+----------------+-----------+----------+--------+---------------------------------------------------------------------------------------------+

...

Gather Perf Summary:
+----------------+-----------+---------+--------+------------------------------------------------------------------------------------------+
| Node           | Status    | Size    | Time   | PackPath                                                                                 |
+================+===========+=========+========+==========================================================================================+
| 11.162.218.126 | Completed | 12.530K | 6 s    | /home/test/gather_pack_20231103111342/perf_192.168.1.111_20231103111351.zip              |
+----------------+-----------+---------+--------+------------------------------------------------------------------------------------------+

...

Gather Ob stack Summary:
+----------------+-----------+---------+--------+----------------------------------------------------------------------------------------------+
| Node           | Status    | Size    | Time   | PackPath                                                                                     |
+================+===========+=========+========+==============================================================================================+
| 11.162.218.126 | Completed | 11.567K | 5 s    | /home/test/gather_pack_20231103111342/obstack2_192.168.1.111_20231103111358.zip              |
+----------------+-----------+---------+--------+----------------------------------------------------------------------------------------------+

...

If you want to view detailed obdiag logs, please run:'obdiag display-trace --trace_id afb5d4ad-b723-38bc-a660-d050c94132a3'

Trace ID: fc37da72-79f6-11ee-a367-00163e01c7ce
If you want to view detailed obd logs, please run: obd display-trace fc37da72-79f6-11ee-a367-00163e01c7ce

4. OBD模式下obdiag使用

参见OBD官网文档: https://www.oceanbase.com/docs/community-obd-cn-1000000000314352

5. 附录

  • obdiag 下载地址: https://www.oceanbase.com/softwarecenter
  • obdiag 官方文档: https://www.oceanbase.com/docs/obdiag-cn
  • obdiag github地址: https://github.com/oceanbase/oceanbase-diagnostic-tool

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论