obdiag 使用问题咨询

通过OCP部署的 OB 集群,想用 obdiag 收集日志。第一步需要配置 obdig,参考了文档: obdiag 配置-OceanBase 敏捷诊断工具(obdiag)-OceanBase文档中心-分布式数据库使用文档 ,但报了个错。

现象

[root@server065 soft]# obdiag config -h10.0.0.65 -uroot@sys -P2881 -paaAA11__
[ERROR] Running Error: 'NoneType' object has no attribute 'get'
Trace ID: d8b76242-f869-11ee-ac6b-0050569d8492
If you want to view detailed obdiag logs, please run: obdiag display-trace d8b76242-f869-11ee-ac6b-0050569d8492

查看 trace 信息如下:

[root@server065 soft]# obdiag display-trace b04b479c-f869-11ee-bb4c-0050569d8492
[2024-04-12 09:12:10.805] [DEBUG] - cmd: []
[2024-04-12 09:12:10.805] [DEBUG] - opts: {'h': '10.0.0.65', 'u': 'root@sys', 'p': 'aaAA11__', 'P': '2881'}
[2024-04-12 09:12:10.805] [DEBUG] - mkdir /usr/local/oceanbase-diagnostic-tool/conf/inner_config.yml
[2024-04-12 09:12:10.812] [DEBUG] - mkdir /root/.obdiag/config.yml
[2024-04-12 09:12:10.814] [ERROR] Running Error: 'NoneType' object has no attribute 'get'
[2024-04-12 09:12:10.814] [ERROR] Traceback (most recent call last):
[2024-04-12 09:12:10.814] [ERROR]   File "cmd.py", line 235, in do_command
[2024-04-12 09:12:10.814] [ERROR]   File "cmd.py", line 680, in _do_command
[2024-04-12 09:12:10.814] [ERROR]   File "core.py", line 351, in config
[2024-04-12 09:12:10.814] [ERROR]   File "core.py", line 105, in set_context
[2024-04-12 09:12:10.814] [ERROR]   File "stdio.py", line 940, in __getattribute__
[2024-04-12 09:12:10.814] [ERROR]   File "config.py", line 178, in get_ob_cluster_config
[2024-04-12 09:12:10.814] [ERROR] AttributeError: 'NoneType' object has no attribute 'get'
[2024-04-12 09:12:10.814] [ERROR] 
[2024-04-12 09:12:10.815] [INFO] Trace ID: b04b479c-f869-11ee-bb4c-0050569d8492
[2024-04-12 09:12:10.815] [INFO] If you want to view detailed obdiag logs, please run: obdiag display-trace b04b479c-f869-11ee-bb4c-0050569d8492

线索

  • obdiag 版本:oceanbase-diagnostic-tool-2.0.0-32024041111.el7.x86_64.rpm
  • OS 版本:Linux server065 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
  • python 版本:2.7.5
  • OB 版本:4.3.0.1_101000062024032200-b59432e535c48e8b8828190c803b6c7736413ff9(Mar 22 2024 00:52:21)

抱歉obdiag的使用上存在问题,这里的obdiag应该是没有获取到集群信息,obdiag确实没有做好对应的报错露出,不应该露出这个信息。如果方便的话,这边想收集下信息用于我们这边复现:

  1. 这个集群是商业版的么,还是社区版?
  2. 方便提供下脱敏后的~/.obdiag/config.yml文件么?
  3. 这里的-h10.0.0.65 -uroot@sys -P2881 -paaAA11__可以在对应环境中使用obclient连接上集群么
  1. 企业版 OB 不过我想这个跟 企业版无关。
  2. 这个文件是空的。config 命令失败,所以是空的。
  3. 能连上。如下。
[root@server065 ~]# obdiag config -h10.0.0.65 -uroot@sys -P2881 -paaAA11__
[ERROR] Running Error: 'NoneType' object has no attribute 'get'
Trace ID: f26ad44a-f87c-11ee-b711-0050569d8492
If you want to view detailed obdiag logs, please run: obdiag display-trace f26ad44a-f87c-11ee-b711-0050569d8492
[root@server065 ~]# obdiag display-trace f26ad44a-f87c-11ee-b711-0050569d8492
[2024-04-12 11:30:02.184] [DEBUG] - cmd: []
[2024-04-12 11:30:02.190] [DEBUG] - opts: {'h': '10.0.0.65', 'u': 'root@sys', 'p': 'aaAA11__', 'P': '2881'}
[2024-04-12 11:30:02.191] [DEBUG] - mkdir /usr/local/oceanbase-diagnostic-tool/conf/inner_config.yml
[2024-04-12 11:30:02.210] [DEBUG] - mkdir /root/.obdiag/config.yml
[2024-04-12 11:30:02.212] [ERROR] Running Error: 'NoneType' object has no attribute 'get'
[2024-04-12 11:30:02.212] [ERROR] Traceback (most recent call last):
[2024-04-12 11:30:02.212] [ERROR]   File "cmd.py", line 235, in do_command
[2024-04-12 11:30:02.212] [ERROR]   File "cmd.py", line 680, in _do_command
[2024-04-12 11:30:02.212] [ERROR]   File "core.py", line 351, in config
[2024-04-12 11:30:02.212] [ERROR]   File "core.py", line 105, in set_context
[2024-04-12 11:30:02.212] [ERROR]   File "stdio.py", line 940, in __getattribute__
[2024-04-12 11:30:02.212] [ERROR]   File "config.py", line 178, in get_ob_cluster_config
[2024-04-12 11:30:02.212] [ERROR] AttributeError: 'NoneType' object has no attribute 'get'
[2024-04-12 11:30:02.212] [ERROR] 
[2024-04-12 11:30:02.213] [INFO] Trace ID: f26ad44a-f87c-11ee-b711-0050569d8492
[2024-04-12 11:30:02.213] [INFO] If you want to view detailed obdiag logs, please run: obdiag display-trace f26ad44a-f87c-11ee-b711-0050569d8492

[root@server065 ~]# cat ~/.obdiag/config.yml 
[root@server065 ~]# obclient -h10.0.0.65 -uroot@sys -P2881 -paaAA11__
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221493290
Server version: OceanBase 4.3.0.1 (r101000062024032200-b59432e535c48e8b8828190c803b6c7736413ff9) (Built Mar 22 2024 00:52:21)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

(root@10.0.0.65:2881) [(none)]> select svr_ip, build_version from oceanbase.__all_server;
+-----------+-------------------------------------------------------------------------------------------+
| svr_ip    | build_version                                                                             |
+-----------+-------------------------------------------------------------------------------------------+
| 10.0.0.65 | 4.3.0.1_101000062024032200-b59432e535c48e8b8828190c803b6c7736413ff9(Mar 22 2024 00:52:21) |
+-----------+-------------------------------------------------------------------------------------------+
1 row in set (0.002 sec)

(root@10.0.0.65:2881) [(none)]> 

原因知道了。早期安装了一个 1.6 的版本。后来下载上面新版本 用 rpm -Uvh 安装的。卸载并删除 ~/.obdiag/ 目录,重新安装后 成功了。
谢谢支持。

[root@server065 ~]# obdiag config -h10.0.0.65 -uroot@sys -P2881 -paaAA11__                                                                                                                                                                                                  
Please enter the following configuration !!!                                                                                                                                                                                                                                
Enter your oceanbase host ssh username (default:''): root                                                                                                                                                                                                                   
Enter your oceanbase host ssh password (default:''): ******                                                                                                                                                                                                                 
Enter your oceanbase host ssh_port (default:'22'):                                                                                                                                                                                                                          
Enter your oceanbase install home_path (default:'/root/observer'): /home/admin/oceanbase                                                                                                                                                                                    
Enter your oceanbase data_dir (default:'/home/admin/oceanbase/store'): /home/admin/oceanbase/store/obv43/sstable                                                                                                                                                            
Enter your oceanbase redo_dir (default:'/home/admin/oceanbase/store'): /home/admin/oceanbase/store/obv43/clog                                                                                                                                                               
Enter your need config obproxy [y/N] (default:'N'): N                                                                                                                                                                                                                       
Trace ID: 148a18f8-f899-11ee-99ae-0050569d8492                                                                                                                                                                                                                              
If you want to view detailed obdiag logs, please run: obdiag display-trace 148a18f8-f899-11ee-99ae-0050569d8492                                                                                                                                                             
[root@server065 ~]# obdiag gather all                                                                                                                                                                                                                                       
gather_all start ...                                                                                                                                                                                                                                                        
Download 10.0.0.65:/tmp/sysstat_10.0.0.65_20240412145247.zip                                                                                                                                                                                                                
Downloading [====================] 100.0% [144.93 KB ]                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                            
Gather Sysstat Summary:                                                                                                                                                                                                                                                     
+-----------+-----------+----------+--------+-------------------------------------------------------------------+                                                                                                                                                           
| Node      | Status    | Size     | Time   | PackPath                                                          |                                                                                                                                                           
+===========+===========+==========+========+===================================================================+                                                                                                                                                           
| 10.0.0.65 | Completed | 144.935K | 11 s   | ./gather_pack_20240412145247/sysstat_10.0.0.65_20240412145247.zip |                                                                                                                                                           
+-----------+-----------+----------+--------+-------------------------------------------------------------------+                                                                                                                                                           
Download 10.0.0.65:/tmp/obstack2_10.0.0.65_20240412145259.zip                                                                                                                                                                                                               
Downloading [====================] 100.0% [25.95 KB ]                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                            
Gather Ob stack Summary:
+-----------+-----------+---------+--------+--------------------------------------------------------------------+
| Node      | Status    | Size    | Time   | PackPath                                                           |
+===========+===========+=========+========+====================================================================+
| 10.0.0.65 | Completed | 25.949K | 6 s    | ./gather_pack_20240412145247/obstack2_10.0.0.65_20240412145259.zip |
+-----------+-----------+---------+--------+--------------------------------------------------------------------+
Download 10.0.0.65:/tmp/perf_10.0.0.65_20240412145306.zip
Downloading [====================] 100.0% [10.27 KB ] 

Gather Perf Summary:
+-----------+-----------+---------+--------+----------------------------------------------------------------+
| Node      | Status    | Size    | Time   | PackPath                                                       |
+===========+===========+=========+========+================================================================+
| 10.0.0.65 | Completed | 10.274K | 2 s    | ./gather_pack_20240412145247/perf_10.0.0.65_20240412145306.zip |
+-----------+-----------+---------+--------+----------------------------------------------------------------+
gather log from_time: 2024-04-12 14:23:08, to_time: 2024-04-12 14:54:08

ZipFileInfo:
+-----------+-----------+
| Node      | LogSize   |
+===========+===========+
| 10.0.0.65 | 6.305M    |
+-----------+-----------+
Download 10.0.0.65:/tmp/ob_log_10.0.0.65_20240412142308_20240412145408.zip
Downloading [====================] 100.0% [6.31 MB ]  

Gather Ob Log Summary:
+-----------+-----------+--------+--------+---------------------------------------------------------------------------------+
| Node      | Status    | Size   | Time   | PackPath                                                                        |
+===========+===========+========+========+=================================================================================+
| 10.0.0.65 | Completed | 6.305M | 4 s    | ./gather_pack_20240412145247/ob_log_10.0.0.65_20240412142308_20240412145408.zip |
+-----------+-----------+--------+--------+---------------------------------------------------------------------------------+
gather from_time: 2024-04-12 14:23:13, to_time: 2024-04-12 14:54:13 

Gather ObProxy Log Summary:
+--------+----------+--------+--------+------------+
| Node   | Status   | Size   | Time   | PackPath   |
+========+==========+========+========+============+
+--------+----------+--------+--------+------------+
Trace ID: 4583957e-f899-11ee-90ab-0050569d8492
If you want to view detailed obdiag logs, please run: obdiag display-trace 4583957e-f899-11ee-90ab-0050569d8492