ob-compose.yml文件如下:
version: '3'
services:oceanbase1:image: oceanbase/oceanbase-ce:latestcontainer_name: oceanbase1hostname: oceanbase1ports:- 2881:2881restart: alwaysprivileged: truevolumes:#- //d/obdata/ob:/root/ob#- //d/obdata/obd:/root/.obd- ob:/root/ob- obd:/root/.obd- obagent:/root/obagent
volumes:ob:obd:obagent:
这时候由于windows下/root/obagent路径需要访问linux特殊文件.pid,但windows下却是无效的,因此挂载只能使用Volumes,而不能使用Bind mount直接挂载本地路径。
导致日志出现以下错误:
[2023-11-02 00:29:50.699] [DEBUG] -- 127.0.0.1 program health check
[2023-11-02 00:29:50.700] [DEBUG] -- local execute: cat /root/obagent/run/ob_agentd.pid
[2023-11-02 00:29:50.715] [DEBUG] -- exited code 0
[2023-11-02 00:29:50.716] [DEBUG] -- local execute: cat /root/obagent/run/ob_mgragent.pid
[2023-11-02 00:29:50.726] [DEBUG] -- exited code 1, error output:
[2023-11-02 00:29:50.726] [DEBUG] cat: /root/obagent/run/ob_mgragent.pid: No such file or directory
[2023-11-02 00:29:50.726] [DEBUG]
[2023-11-02 00:29:50.727] [WARNING] failed to start 127.0.0.1 obagent
这可能有几个问题:
1、运行是有上次运行的资料导致失败,解决如下:
把/root/obagent挂载,然后rm -rf /root/obagent/run/*就能成功重启,100%成功。
2、资源不足,通过Trace发现有可能原来分配内存,LOG磁盘空间资源不足 等,也会导致起不来,这时候看日志能看出来,但OB起不来的话,如何设置呢,可以通过以下3条命令重新设置:
[root@oceanbase1 bin]#echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/ob/lib/' >> ~/.bash_profile
[root@oceanbase1 bin]#source ~/.bash_profile
[root@oceanbase1 bin]# ./observer -o log_disk_size =18G
./observer -o log_disk_size =18G
optstr: log_disk_size