KingbaseES 配置root.sh实现数据库服务开机自启动
案例说明:
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实现数据库服务开机自启动的更多相关文章
- 配置Redis集群为开机自启动
vim /etc/init.d/redisc 将下方脚本写入redisc文件中 #!/bin/sh # chkconfig: 2345 80 90 # # Simple Redis init.d sc ...
- centos7下安装、配置Nginx、设置Nginx开机自启动
测试环境: [root@centos-linux ~]# cat /etc/redhat-releaseCentOS Linux release 7.6.1810 (Core) [root@cento ...
- 在CentO7系统上配置Springboot项目jar包开机自启动
官方文档地址:https://docs.spring.io/spring-boot/docs/current/reference/html/deployment.html#deployment-ins ...
- 阿里云centos7.4安装并部署svn1.10.0版本(配置多仓库,加入开机自启动)
如何安装最新版本 1.10.0: 如果已安装旧版本,先卸载 yum remove subversion* 查看当前可安装的版本 yum list | grep subversion 可以去官网下载安装 ...
- Ubu18开机自启动-Systemd
参考链接: https://blog.csdn.net/qq_16268979/article/details/114771854 本文内容为个人测试记录,具体文件目录请以读者自己电脑为准,此处只是提 ...
- Ubuntu编写开机自启动脚本(转载)
From:http://blog.csdn.net/marujunyy/article/details/8466255 1.首先编写一个简单的shell脚本test.sh #! /bin/bash e ...
- Centos配置tomcat服务并且开机自启动
把要配置成服务的tomcat文件夹中的catalina.sh脚本文件拷一份到/etc/init.d目录,并且改文件名称为tomcat6 cp /usr/web/tomcat/tomcat-/bin/c ...
- CentOS6.8下安装redis并配置开机自启动
参考资料:http://www.bubuko.com/infodetail-1006383.html http://www.cnblogs.com/skyessay/p/6433349.html ...
- 【Linux】Cent OS 虚拟机开机自启动配置
一次断电,导致实体机关机了,虚拟机也连不上去,只好手动来起来. 我想增加一下自启动,让硬件开机的时候,自动启动虚拟机: 其实是有办法的,尝试了一下,也成功了,这里简单标记下. virsh autost ...
- Ubuntu14.04配置nginx开机自启动项
原文: https://www.jianshu.com/p/2e03255cfabb ubuntu配置开机自动启动服务 ---------------------------------------- ...
随机推荐
- Java 23种设计模式的分类和使用场景
听说过GoF吧? GoF是设计模式的经典名著Design Patterns: Elements of Reusable Object-Oriented Software(中译本名为<设计模式-- ...
- ORA-24247问题解决
错误信息: scott@ORCL> select utl_http.request('www.baidu.com') from dual; select utl_http.request('ww ...
- python项目vscode配置
最近由pycharm切到VScode, 记录一下项目的通用配置; 在项目目录建一个.vscode的文件夹分别创建三个文件 lunch.json python运行配置 settings.json vsc ...
- win32 - Rendering a Stream示例
仅供参考 文档: Rendering a Stream 代码示例: #include <cstdio> #include <Windows.h> // Windows mult ...
- Ubuntu18.04搭建Vue开发环境
更新软件源列表 sudo apt update nodejs安装 sudo apt install nodejs nodejs -v #查看版本 npm安装 sudo apt install npm ...
- 使用原生 cookieStore 方法,让 Cookie 操作更简单
前言 对于前端来讲,我们在操作cookie时往往都是基于document.cookie,但它有一个缺点就是操作复杂,它并没有像localStorage那样提供一些get或set等方法供我们使用.对与c ...
- 【生成对抗网络学习 其二】GAN(keras实现)代码阅读笔记
想来想去还是记录一下吧,主要是怕以后时间长忘了 好记性不如烂笔头 代码来自eriklindernoren的开源GAN实现:https://github.com/eriklindernoren/Kera ...
- FROM_UNIXTIME函数格式化时间戳日期类型
select FROM_UNIXTIME(bce.daysec_time/1000,'%Y-%m-%d %h:%i:%s') ,bce.* from biz_cvent bce where bce.d ...
- 如何提高UI自动化稳定性?
1尽量使用相对路径的xpath表达式定位元素 2查找元素优先使用显示等待方式 3用例与用例之间避免产生依赖,用例可以单独运行 4用例执行结束之后要对测试场景进行还原,避免影响到其他用例的执行 5脚本执 ...
- SpringCloud Hystrix断路器的基本使用
官网资料: https://github.com/Netflix/Hystrix/wiki/How-To-Use 1. 服务雪崩 分布式系统面临的问题 复杂分布式体系结构中的应用程序有数十个依赖关系, ...