案例说明:

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. Js捕获异常的方法

    Js捕获异常的方法 JavaScript的异常主要使用try catch finally语句以及窗口对象window的onerror事件来捕获. try catch finally try catch ...

  2. Js中Symbol对象

    Js中Symbol对象 ES6引入了一种新的基本数据类型Symbol,表示独一无二的值,最大的用法是用来定义对象的唯一属性名,Symbol()函数会返回symbol类型的值,该类型具有静态属性和静态方 ...

  3. win32 - IFolderView2::GetCurrentFolderFlags的使用

    网上关于IFolderView2接口调用的示例有点少. 下面的例子是将桌面的图标隐藏起来,使用了FWF_NOICONS样式. #include <ShlObj.h> // Shell AP ...

  4. win32 - 使用LookupAccountName查找SID

    可以使用LookupAccountNameA获取sid. LookupAccountName函数接受系统名称和帐户作为输入.它检索该帐户的安全标识符(SID)以及在其上找到该帐户的域的名称. 使用此a ...

  5. Ansible的基本配置

    目录 定义主机和组 主机的定义 主机组的定于 主机组的嵌套 选择主机和组 匹配主机 使用通配符匹配 配置文件优先级 配置文件详解 配置文件段 配置文件参数说明 配置案例 1. 在节点上创建一个普通用户 ...

  6. 麒麟系统开发笔记(五):制作安装麒麟系统的启动U盘、物理机安装麒麟系统以及搭建Qt开发环境

    前言   电脑从U盘装麒麟系统,搭建实机Qt开发运行环境.   制作麒麟系统U盘(使用LiveUSB) 步骤一:先准备个至少8GB的U盘   之前购买的一批联想U盘,如下图:    查看U盘:   步 ...

  7. day05---系统的重要文件(3)

    1) /usr/local 编辑 安装的软件 第三方软件安装位置 软件安装的三种方法 1.yum安装 自动解决依赖问题 yum [选项参数] 包名 第一个里程碑:我想要安装的软件的名字 或者是 知道命 ...

  8. 【Azure 微服务】面对Service Fabric中节点状态不正常(Disabling/Warning/RemoveNode)的几种尝试解决方案

    问题描述 发现 Service Fabric 的节点状态异常,如出现 Disabling, Warning,或者 RemoveNode的情况,并且持续很长时间都没有变化(2小时以上).如何来缓解这种问 ...

  9. 4、zookeeper的事件监听机制

    watcher概念 https://zookeeper.apache.org/doc/r3.4.14/zookeeperProgrammers.html#sc_WatchRememberThese z ...

  10. 面试准备不充分,被Java守护线程干懵了,面试官主打一个东西没用但你得会

    写在开头 面试官:小伙子请聊一聊Java中的精灵线程? 我:什么?精灵线程?啥时候精灵线程? 面试官:精灵线程没听过?那守护线程呢? 我:守护线程知道,就是为普通线程服务的线程嘛. 面试官:没了?守护 ...