一、准备环境
以下命令使用root用户执行
bash
# 安装系统维护工具
dnf install open-vm-tools net-tools vim tar unzip wget curl sysstat -y
# 安装中文支持,数据库安装步骤默认使用中文,
dnf install glibc-langpack-zh fontconfig -y
# 创建目录
mkdir /opt/Kingbase/ES/V9 -p
chmod o+rwx /opt/Kingbase/ES/V9
# 修改系统内核参数
cat >>/etc/sysctl.conf<<EOF
fs.aio-max-nr= 1048576
fs.file-max= 6815744
kernel.shmall= 2097152
kernel.shmmax= 4294967295
kernel.shmmni= 4096
kernel.sem= 250 32000 100 128
net.ipv4.ip_local_port_range= 9000 65500
net.core.rmem_default= 262144
net.core.rmem_max= 4194304
net.core.wmem_default= 262144
net.core.wmem_max= 1048576
EOF
# 应用新内核参数
sysctl -p
# 添加 KingBase 数据库用户并设置密码
useradd -m kingbase
passwd kingbase
# 创建数据库安装包挂载目录
mkdir /home/kingbase/KingbaseES
# 挂载数据库安装包ISO文件
mount /root/KingbaseES_V009R001C002B0014_Lin64_install.iso /home/kingbase/KingbaseES
二、安装数据库应用
以下内容使用kingbase用户执行
bash
# 设置当前会话为中文模式
export LANG=zh_CN.UTF-8
# 进入安装包目录
cd KingbaseES
# 命令行交互式安装数据库
./setup.sh -i console
# 以下截图为数据库安装过程






三、设置数据库开机启动
由于我在安装数据库完成后执行数据库服务注册时一直报错,通过分析服务注册脚本发现:在rockyLinux下服务注册位置目录不存在,因此决定采用 systemd 进程管理工具来管理数据库服务。
以下内容使用root用户执行
注意 以下内容中,
INSTALLDIR
、DATADIR
、User
和Group
如果没有使用默认配置,将这几个参数修改为自己的实际参数值即可
bash
INSTALLDIR=/opt/Kingbase/ES/V9
DATADIR=/opt/Kingbase/ES/V9/data
cat > /etc/systemd/system/kingbased.service <<EOF
[Unit]
Description=Kingbase V9 database server
After=network.target
[Service]
Type=forking
User=kingbase
Group=kingbase
# Environment variables
Environment=LD_LIBRARY_PATH=$INSTALLDIR/Server/lib
Environment=PATH=$INSTALLDIR/Server/bin:$PATH
# Commands to manage the service
ExecStart=${INSTALLDIR}/Server/bin/sys_ctl -w start -D ${DATADIR} -l ${DATADIR}/sys_log/startup.log
ExecStop=${INSTALLDIR}/Server/bin/sys_ctl stop -m fast -w -D ${DATADIR}
# Restart settings
Restart=on-failure
RestartSec=5
# Limits
LimitNOFILE=65536
LimitNPROC=65536
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start kingbased
systemctl enable kingbased