摘要:检查数据库服务[root@gbase8a1 ~]# ps -ef|grep gbaseavahi 9796 1 0 15:07 ? 00:00:00 avahi-daemon: running [gbase8a1.local]gbase 10658 1 0 1
南大通用GBase 8a数据库安装后需要手动设置开机自启,确保主机启动后数据库可以正常运行。
方式如下:
1.将服务自启命令写入rc.local
[root@gbase8a1 ~]# echo 'su - gbase -c "gcluster_services all restart"' >> /etc/rc.local
[root@gbase8a1 ~]# echo 'su - gbase -c "gcware_services all restart"' >> /etc/rc.local
2.文件默认是没有执行权限的,所以需要授权
[root@gbase8a1 ~]# chmod +x /etc/rc.local
[root@gbase8a1 ~]# ls -l /etc/rc.local
lrwxrwxrwx. 1 root root 13 Sep 1 2023 /etc/rc.local -> rc.d/rc.local
3.启用rc-local.service
[root@gbase8a1 ~]# systemctl enable rc-local.service
重启验证
[root@gbase8a1 ~]# reboot
检查数据库服务
[root@gbase8a1 ~]# ps -ef|grep gbase
avahi 9796 1 0 15:07 ? 00:00:00 avahi-daemon: running [gbase8a1.local]
gbase 10658 1 0 15:07 ? 00:00:00 /opt/192.168.8.36/gnode/server/bin/gbased
gbase 11566 1 0 15:07 ? 00:00:00 /opt/192.168.8.36/gnode/server/bin/gc_sync_server
gbase 11576 1 0 15:07 ? 00:00:00 /opt/192.168.8.36/gcluster/server/bin/gcmonit --start
gbase 11578 1 0 15:07 ? 00:00:00 /opt/192.168.8.36/gcluster/server/bin/gcmmonit --start
gbase 11583 1 2 15:07 ? 00:00:02 /opt/192.168.8.36/gcluster/server/bin/gclusterd
gbase 11605 1 1 15:07 ? 00:00:01 /opt/192.168.8.36/gcluster/server/bin/gcrecover
gbase 11666 1 0 15:07 ? 00:00:00 /opt/192.168.8.36/gcware/sbin/gcware
gbase 11674 1 0 15:07 ? 00:00:00 /opt/192.168.8.36/gcware/sbin/gcware_monit --start
gbase 11676 1 0 15:07 ? 00:00:00 /opt/192.168.8.36/gcware/sbin/gcware_mmonit --start
这里进程都已正常
[gbase@gbase8a1:/opt]$gcluster_services all info
/opt/192.168.8.36/gcluster/server/bin/gclusterd is running
/opt/192.168.8.36/gcluster/server/bin/gcrecover is running
/opt/192.168.8.36/gnode/server/bin/gbased is running
/opt/192.168.8.36/gnode/server/bin/gc_sync_server is running
服务运行正常
总结:
开机自启可以在主机异常重启后自动恢复数据库服务,而rc.local文件的作用是可以开机时启动服务,不同的操作系统里路径一般为/etc/rc.local或者/etc/rc.d/rc.local,我们还可以通过该脚本实现关闭透明大页,开机设置环境变量等功能。
来源:GBASE南大通用