案例说明:

KingbaseES数据库在部署完成后,支持数据库服务开机自启动,部署完成后,root用户(Linux)执行安装软件目录下的root.sh脚本后,可以实现数据库服务开机自启动。

适用版本:

KingbaseES V8R3/R6

操作系统:

Linux

一、脚本存储目录

[kingbase@node102 script]$ pwd
/opt/Kingbase/ES/V8R6_C7/install/script [kingbase@node102 script]$ ls -lh
total 52K
-rwxr-xr-x 1 kingbase kingbase 321 Oct 29 14:47 consoleCloud-uninstall.sh
-rwxr-x--- 1 kingbase kingbase 2.2K Oct 29 14:47 initcluster.sh
-rwxr-x--- 1 kingbase kingbase 289 Oct 29 14:47 javatools.sh
-rwxr-x--- 1 kingbase kingbase 21K Oct 29 14:47 mkln.sh
-rwxr-xr-x 1 kingbase kingbase 542 Oct 29 14:47 rootDeployClusterware.sh
-rwxr-x--- 1 kingbase kingbase 712 Mar 3 15:11 root.sh
-rwxr-x--- 1 kingbase kingbase 690 Oct 29 14:47 rootuninstall.sh
-rwxrwxrwx 1 kingbase kingbase 3.7K Oct 29 14:47 startupcfg.sh

二、编辑脚本

Tips:

脚本在安装完数据库软件后,默认不需要修改其配置,可以由root用户直接执行;但是在做了静默安装或者后期运行一段时间后,需要再部署数据库服务自启动,可以通过修改脚本(通用机环境)后执行root.sh。如下所示,可以修改相应的脚本参数。

[kingbase@node102 script]$ cat root.sh
#!/bin/bash ROOT_UID=0
#INSTALLDIR=@@INSTALL_DIR@@ #数据库软件安装路径
INSTALLDIR='/opt/Kingbase/ES/V8R6_C7'
#USERNAME=@@USER_NAME@@ #数据库部署用户
USERNAME=kingbase
#DATADIR=@@DATA_DIR@@ #数据库data目录存储路径
DATADIR='/data/kingbase/v8r6_c7/data'
VERSION=V8
SERVICENAME=kingbase8d # Run as root, of course.
if [ x"$UID" != x"$ROOT_UID" ]
then
echo "Must be root to run this script, and root.sh should be executed in the '$0' way, not 'sh $0'."
exit 1
fi if [ -d $INSTALLDIR/Scripts ]; then
$INSTALLDIR/Scripts/startupcfg.sh $VERSION $USERNAME $INSTALLDIR $DATADIR $SERVICENAME
elif [ -d $INSTALLDIR/install/script ]; then
$INSTALLDIR/install/script/startupcfg.sh $VERSION $USERNAME $INSTALLDIR $DATADIR $SERVICENAME
else
"can not find startupcfg.sh"
fi

三、执行脚本

[root@node102 script]# sh root.sh
Starting KingbaseES V8:
waiting for server to start.... done
server started
KingbaseES V8 started successfully

四、数据库自启动服务管理

1、服务启动脚本

#在系统/etc/init.d下生成kingbase8d的启动脚本

[root@node102 ~]# cd /etc/init.d/
[root@node102 init.d]# ls -lh
total 56K
-rw-r--r-- 1 root root 18K May 22 2020 functions
-rwxr-xr-x 1 root root 3.2K Mar 7 10:57 kingbase8d
-rwxr-xr-x 1 root root 11K Jan 6 16:18 mysqld
-rwxr-xr-x 1 root root 4.5K May 22 2020 netconsole
-rwxr-xr-x 1 root root 7.8K May 22 2020 network
-rw-r--r-- 1 root root 1.2K Jan 14 2022 README

如下图所示脚本内容(禁止修改):

2、查看服务状态

[root@node102 init.d]# service kingbase8d status
sys_ctl: server is running (PID: 1435)
/opt/Kingbase/ES/V8R6_C7/KESRealPro/V008R006C007B0012/Server/bin/kingbase "-D" "/data/kingbase/v8r6_c7/data" [root@node102 init.d]# systemctl status kingbase8d
● kingbase8d.service - LSB: Start and stop the kingbase server
Loaded: loaded (/etc/rc.d/init.d/kingbase8d; bad; vendor preset: disabled)
Active: active (exited) since Mon 2023-03-06 09:46:21 CST; 33min ago
..... [root@node102 init.d]# chkconfig --list kingbase8d
......
kingbase8d 0:off 1:off 2:on 3:on 4:on 5:on 6:off

3、修改数据库服务自启动配置

#在系统多用户和图形化多用户级别,禁止kingbase8d系统自启动

[root@node102 init.d]# chkconfig --level 3 kingbase8d off
[root@node102 init.d]# chkconfig --level 5 kingbase8d off
[root@node102 init.d]# chkconfig --list kingbase8d
kingbase8d 0:off 1:off 2:on 3:off 4:on 5:off 6:off

4、启动和停止数据库服务

#启动数据库服务
[root@node102 init.d]# service kingbase8d start
Starting KingbaseES V8:
waiting for server to start.... done
server started
KingbaseES V8 started successfully #停止数据库服务
[root@node102 init.d]# service kingbase8d stop
Stopping KingbaseES V8:
waiting for server to shut down....... done
server stopped

KingbaseES 配置root.sh实现数据库服务开机自启动的更多相关文章

  1. 配置Redis集群为开机自启动

    vim /etc/init.d/redisc 将下方脚本写入redisc文件中 #!/bin/sh # chkconfig: 2345 80 90 # # Simple Redis init.d sc ...

  2. centos7下安装、配置Nginx、设置Nginx开机自启动

    测试环境: [root@centos-linux ~]# cat /etc/redhat-releaseCentOS Linux release 7.6.1810 (Core) [root@cento ...

  3. 在CentO7系统上配置Springboot项目jar包开机自启动

    官方文档地址:https://docs.spring.io/spring-boot/docs/current/reference/html/deployment.html#deployment-ins ...

  4. 阿里云centos7.4安装并部署svn1.10.0版本(配置多仓库,加入开机自启动)

    如何安装最新版本 1.10.0: 如果已安装旧版本,先卸载 yum remove subversion* 查看当前可安装的版本 yum list | grep subversion 可以去官网下载安装 ...

  5. Ubu18开机自启动-Systemd

    参考链接: https://blog.csdn.net/qq_16268979/article/details/114771854 本文内容为个人测试记录,具体文件目录请以读者自己电脑为准,此处只是提 ...

  6. Ubuntu编写开机自启动脚本(转载)

    From:http://blog.csdn.net/marujunyy/article/details/8466255 1.首先编写一个简单的shell脚本test.sh #! /bin/bash e ...

  7. Centos配置tomcat服务并且开机自启动

    把要配置成服务的tomcat文件夹中的catalina.sh脚本文件拷一份到/etc/init.d目录,并且改文件名称为tomcat6 cp /usr/web/tomcat/tomcat-/bin/c ...

  8. CentOS6.8下安装redis并配置开机自启动

    参考资料:http://www.bubuko.com/infodetail-1006383.html   http://www.cnblogs.com/skyessay/p/6433349.html ...

  9. 【Linux】Cent OS 虚拟机开机自启动配置

    一次断电,导致实体机关机了,虚拟机也连不上去,只好手动来起来. 我想增加一下自启动,让硬件开机的时候,自动启动虚拟机: 其实是有办法的,尝试了一下,也成功了,这里简单标记下. virsh autost ...

  10. Ubuntu14.04配置nginx开机自启动项

    原文: https://www.jianshu.com/p/2e03255cfabb ubuntu配置开机自动启动服务 ---------------------------------------- ...

随机推荐

  1. 基于Android的“哲学家就餐问题”防死锁的设计与实现

    1问题描述 如图1.1,有5个哲学家围着一个大圆桌就餐.哲学家和筷子都按逆时针顺序编号,每个哲学家的编号与他左边的筷子的编号一致. 规定如下: (1)哲学家之间不相互交流: (2)哲学家只做两件事:吃 ...

  2. Hooks与普通函数的区别

    Hooks与普通函数的区别 在这里的Hooks具体指的是自定义Hooks,自定义的Hooks与我们定义的普通函数类似,都可以封装逻辑,以实现逻辑的复用.Hooks实际上是一种特殊的函数,而由于Hook ...

  3. ysoserial CommonsCollections1 分析

    /* Gadget chain: ObjectInputStream.readObject() AnnotationInvocationHandler.readObject() Map(Proxy). ...

  4. Innodb 存储引擎表

    目录 索引组织表 Innodb逻辑存储结构 表空间 段 区 页 行 Innodb 行记录格式 Compact Redundant 行溢出数据 Compressed 和 Dynamic 行记录格式 ch ...

  5. 项目实战:Qt球机控制工具 v1.0.0(球机运动八个方向以及运动速度,设置运动到指定角度,查询当前水平和垂直角度)

    需求   1.调试球机控制,方向速度,设置到指定的角度:  2.支持串口,485等基于串口的协议端口配置打开:  3.子线程串口控制和.子线程协议解析:  4.支持球机水平运动速度.垂直运动速度设置: ...

  6. 【八股cover#2】CPP语法 Q&A与知识点

    CPP语法 Q&A与知识点 简历cover 1.熟练使用C的指针应用及内存管理 指针与引用的区别 指针是一个存储地址的变量,可以有多级,可以为空,并且在初始化后可以改变指向: 引用是原变量的别 ...

  7. 【LeetCode剑指offer 03】合并两个/K个排序链表

    合并两个排序链表 https://leetcode.cn/problems/he-bing-liang-ge-pai-xu-de-lian-biao-lcof 输入两个递增排序的链表,合并这两个链表并 ...

  8. 【Azure 应用服务】如何来检查App Service上证书的完整性以及在实例中如何查找证书是否存在呢?

    问题描述 1:如何来检查App Service上证书的完整性呢? 2:如何来检查App Service的实例上是否包含这个证书呢? Windows 环境 or  Linux 环境? 问题解答 问题一: ...

  9. 【Azure 事件中心】适用Mirror Maker生产数据发送到Azure Event Hub出现发送一段时间后Timeout Exception: Expiring 18 record(s) for xxxxxxx: 79823 ms has passed since last append

    问题描述 根据"将 Apache Kafka MirrorMaker 与事件中心配合使用"一文,成功配置了Mirror Maker来发送数据到Event Hub中.为什么只能成功运 ...

  10. 【Azure Developer】如何通过Azure REST API 获取到虚拟机(VM)所使用的公共IP地址信息

    问题描述 如何通过Azure REST API 获取到虚拟机(VM)所使用的公共IP地址信息 问题解答 由于直接获取到的虚拟机信息(Virtual Machines - Get)中,并不会包含虚拟机的 ...