oceanbase/obdiag

[Question]: observer安装目录和运行目录不在同一目录导致Diagnostic执行报错

Opened this issue · 6 comments

Description

OceanBase Diagnostic Tool: 2.2.0

systemctl observer config:
[Unit]
Description=observer

[Service]
Type=forking
WorkingDirectory=/data/observer
ExecStart=/home/op1/oceanbase/bin/observer

Restart=on-failure
RestartSec=5
StartLimitInterval=0
User=op1
Group=op1
Environment="LD_LIBRARY_PATH=/home/op1/oceanbase/lib"
[Install]
WantedBy=multi-user.target

Due to WorkingDirectory=/data/observer, the pid file path is /data/observer/run/observer.pid
When i set home_path: /home/op1/oceanbase, running obdiag throw exception: 'cat: /home/op1/oceanbase/run/observer.pid: No such file or directory'.
When i set home_path: /data/observer, running obdiag throw exception: '/data/observer/bin/observer: No such file or directory'.

~/.obdiag/config.yml 中observer 的home_path应该是WorkingDirectory

~/.obdiag/config.yml 中observer 的home_path应该是WorkingDirectory

When i set home_path: /data/observer, running obdiag throw exception: '/data/observer/bin/observer: No such file or directory'.

这个部署方式是你们自己写的部署方式吗,非官方文档标准的部署方式

安装目录和运行目录,不在同一个磁盘目录是一个常规需求,不应该绑定pid在ob_install_dir目录。能否home_path拆分成两个变量,install_dir、work_dir,默认这两个变量都是一样,但是允许用户指定。

官方文档:
# observer的安装目录,例如observer的可执行程序为/root/observer/bin/observer
# 则需要填写的home_path为/root/observer
home_path: /root/observer

pid源码:

def get_observer_pid(ssh_client, ob_install_dir, stdio=None):
"""
get observer pid
:return:
"""
try:
cmd = "cat {ob_install_dir}/run/observer.pid".format(ob_install_dir=ob_install_dir)
pids = ssh_client.exec_cmd(cmd)
pid_list = pids.split()
stdio.verbose("get observer pid, run cmd = [{0}], result:{1} ".format(cmd, pid_list))
except:
stdio.verbose("get observer pid failed")
return []
return pid_list

good idea

纳入2.4.0 迭代