如何设置OceanBase开机自启动?

oceanbase.service文件如下:
[Unit]
Description=OceanBase Start
After=network.target

[Service]
Type=forking
ExecStart=/etc/systemd/system/ocean_start.sh
ExecStop=/opt/software/oceanbase-all-in-one/obd/usr/bin/obd cluster stop obtest
ExecReload=/opt/software/oceanbase-all-in-one/obd/usr/bin/obd cluster restart obtest

[Install]
WantedBy=multi-user.target

/etc/systemd/system/ocean_start.sh 文件如下:
#!/bin/bash
echo “Hello World!”
/opt/software/oceanbase-all-in-one/obd/usr/bin/obd cluster start obtest

执行命令如下:
sudo systemctl start oceanbase.service

报错如下:
Job for oceanbase.service failed because the control process exited with error code.
See “systemctl status oceanbase.service” and “journalctl -xeu oceanbase.service” for details.
wsw@wsw:~$ systemctl status oceanbase.service
× oceanbase.service - OceanBase Start
Loaded: loaded (/etc/systemd/system/oceanbase.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Wed 2024-07-24 14:25:32 CST; 11s ago
Process: 4089 ExecStart=/etc/systemd/system/ocean_start.sh (code=exited, status=127)
CPU: 1ms

7月 24 14:25:32 wsw systemd[1]: Starting OceanBase Start…
7月 24 14:25:32 wsw ocean_start.sh[4089]: [41B blob data]
7月 24 14:25:32 wsw systemd[1]: oceanbase.service: Control process exited, code=exited, status=127/n/a
7月 24 14:25:32 wsw systemd[1]: oceanbase.service: Failed with result ‘exit-code’.
7月 24 14:25:32 wsw systemd[1]: Failed to start OceanBase Start.

1 个赞

设置 OBServer 节点开机自启动

https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000001052977

2 个赞

不好用。

目前官方推荐是这样 如果感觉不好用 你说一下原因 列举出来 我们这边反馈下 后期评估一下 看看是否可以修改

如何是obd部署的单节点呢,这个脚本不适用吧,obd不是启动的是一个集群吗