一、环境介绍
操作系统:Centos 7.6
KES版本:KingbaseES_V008R006C007B0024_Lin64_install.iso
JDK版本:JDK 1.8 +
二、安装前准备
1.创建用户
[root@kes1 /]# useradd kingbase
[root@kes1 /]# id kingbase
uid=1000(kingbase) gid=1000(kingbase) groups=1000(kingbase)
[root@kes1 /]#
2.创建目录
创建目录
#软件包路径
mkdir -p /home/kingbase/KingbaseES/V8
#软件安装目录
mkdir -p /opt/Kingbase/ES/V8
#数据路径
mkdir -p /data/Kingbase
赋权
chown kingbase:kingbase -R /home/kingbase/KingbaseES/V8
chown kingbase:kingbase -R /opt/Kingbase/
chown kingbase:kingbase -R /data/Kingbase/
3.修改内核参数
#查看内存大小
[root@kes1 ~]# free
total used free shared buff/cache available
Mem: 3861480 115316 3525084 11852 221080 3489296
Swap: 0 0 0
#内存为3861480*1024=3,954,155,520,shmmax大小为总内存小1字节
#修改内核参数
cat >> /etc/sysctl.conf <<EOF
#add by kingbase
fs.aio-max-nr= 1048576
fs.file-max= 6815744
kernel.shmall= 2097152
kernel.shmmax= 3954155519
kernel.shmmni= 4096
kernel.sem= 250 32000 100 128
net.core.rmem_default= 262144
vm.dirty_background_ratio=2
vm.dirty_ratio = 40
vm.overcommit_memory = 2
vm.overcommit_ratio = 90
vm.swappiness = 0
fs.file-max = 6815744
fs.nr_open = 20480000
#TCP端口使用范围
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 6000
# 记录的那些尚未收到客户端确认信息的连接请求的最大值
net.ipv4.tcp_max_syn_backlog = 65536
# 每个网络接口接收数据包的速率比内核处理这些包的速率快时,允许送到队列的数据包的最大数目
net.core.somaxconn=1024
net.core.netdev_max_backlog = 32768
net.core.wmem_default = 8388608
net.core.wmem_max = 1048576
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_syn_retries = 2
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_wmem = 8192 436600 873200
net.ipv4.tcp_rmem = 32768 436600 873200
net.ipv4.tcp_mem = 94500000 91500000 92700000
net.ipv4.tcp_max_orphans = 3276800
EOF
#立即生效
[root@kes1 sysctl.d]# sysctl -p
4.修改用户限制
cat >> /etc/security/limits.conf <<EOF
#add by kingbase
kingbase soft nproc 65536
kingbase hard nproc 65536
kingbase soft nofile 65536
kingbase hard nofile 65536
kingbase soft stack 10240
kingbase hard stack 32768
kingbase soft core unlimited
kingbase hard core unlimited
EOF
5.关闭SWAP
[root@kes1 sysctl.d]# swapoff -a
[root@kes1 sysctl.d]# free -m
total used free shared buff/cache available
Mem: 3770 113 3426 11 230 3398
Swap: 0 0 0
[root@kes1 sysctl.d]#
6.关闭SElinux 和防火墙
#关闭SElinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
# 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
7.安装JAVA
#解压
tar -zxf jdk-8u361-linux-x64.tar.gz
#配置环境变量
cat > /etc/profile.d/kes.sh <<EOF
export JAVA_HOME=/root/jdk1.8.0_361
export KINGBASE_DATA=/data/Kingbase/
export CLASSPATH=.:/root/jdk1.8.0_361/lib/
export PATH=$PATH:/root/jdk1.8.0_361/bin:/opt/Kingbase/bin
EOF
#重新登录或source ~/.bash_profile
[root@kes1 ~]# java -version
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 1.8.0_361-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)
三、安装过程
挂载安装介质
mount -o loop /root/KingbaseES_V008R006C007B0024_Lin64_install.iso /mnt
cp -r /mnt/* /home/kingbase/KingbaseES/V8/
chown kingbase:kingbase -R /home/kingbase/KingbaseES/
[root@kes1 ~]# ll /home/kingbase/KingbaseES/V8/
total 4
dr-xr-xr-x. 2 kingbase kingbase 54 Aug 19 00:01 setup
-r-xr-xr-x. 1 kingbase kingbase 3829 Aug 19 00:01 setup.sh
控制台安装
#切换用户和目录
[root@kes1 ~]# su - kingbase
[kingbase@kes1 ~]$ cd KingbaseES/V8/
#开始安装
[kingbase@kes1 V8]$ sh setup.sh -i console
Now launch installer...
Preparing to install
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
Launching installer...
===============================================================================
KingbaseES V8 (created with InstallAnywhere)
-------------------------------------------------------------------------------
Preparing CONSOLE Mode Installation...
===============================================================================
Please Wait
-----------
===============================================================================
Welcome
-------
This installer will guide you through the installation of KingbaseES V8.
It is strongly recommended that you quit all programs before continuing with
this installation. You may cancel this installation by typing 'quit'.
KingbaseES Version: V8
Kingbase Type:BMJ-NO
Installer Version: V008R006C007B0024
Install DATE:202408191206
Kingbase Inc.
http://www.kingbase.com.cn
PRESS <ENTER> TO CONTINUE:
#一路回车
选择Y
Beijing Kingbase Information Technologies Inc.
Add: 3 layer, B block, Information Industrial Park, Rongda Road 7, Chaoyang
District, Beijing, 100102 China
Tel: 86-10-5885 1118
Http: //www.kingbase.com.cn
National Hotline: 400-601-1188
Support E-mail: support@kingbase.com.cn
DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): y
选择安装集
Choose Install Set
------------------
Please choose the Install Set to be installed by this installer.
->1- Full
2- Client
3- Custom
ENTER THE NUMBER FOR THE INSTALL SET, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
: 1
指定授权文件路径 /home/kingbase/license_29404_0.dat
Choose License File
-------------------
File Path: /home/kingbase/license_29404_0.dat
指定软件安装路径,默认回车
Choose Install Folder
---------------------
Please choose a destination folder for this installation.
Where would you like to install?
Default Install Folder: /opt/Kingbase/ES/V8
ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
:
安装汇总,回车
Pre-Installation Summary
------------------------
Please Review the Following Before Continuing:
Product Name:
KingbaseES V8
Install Folder:
/opt/Kingbase/ES/V8
Product Features:
SERVER,
INTERFACE,
DEPLOY,
KINGBASEHA,
KSTUDIO,
KDTS
Install Disk Space Information
Require Disk space : 5235 MB Free Disk Space : 33841 MB
PRESS <ENTER> TO CONTINUE:
开始安装,回车
Ready To Install
----------------
InstallAnywhere is now ready to install KingbaseES V8 onto your system at the
following location:
/opt/Kingbase/ES/V8
PRESS <ENTER> TO INSTALL:
数据库初始化
#指定数据路径
Choose a Folder for data directory
----------------------------------
Please choose a folder. The folder must be empty.
Data folder (Default: /opt/Kingbase/ES/V8/data): /data/Kingbase/
#指定默认端口
Port
----
Please enter database service listened port, default 54321.
Port (Default: 54321):
#指定默认用户
User
----
Please enter database administrator user name.
User: (Default: system):
#默认密码 123
Enter Password
--------------
Please Enter the Password: Please Enter the Password:****
===============================================================================
Enter Password again
--------------------
Please Enter the Password Again: Please Enter the Password Again:****
#默认字符集
Server Encoding
---------------
Please enter server character set encoding.
->1- UTF8
2- GBK
3- GB18030
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 1
#数据库模式 1
Database Mode
-------------
Please enter database mode.
1- PG
->2- ORACLE
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 1
#大小写敏感
Case Sensitivity
----------------
Please enter the case sensitivity.
->1- YES
2- NO
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 1
#默认块大小
Block Size
----------
Please enter block size used in storing data.
->1- 8k
2- 16k
3- 32k
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 1
Tips
----
The database will be initialized, which may take some time. Please be patient.
PRESS <ENTER> TO CONTINUE:
执行root脚本
Installation Complete
---------------------
Congratulations. KingbaseES V8 has been successfully installed to:
/opt/Kingbase/ES/V8
If you want to register KingbaseES V8 as OS service, please run
/opt/Kingbase/ES/V8/install/script/root.sh
PRESS <ENTER> TO EXIT THE INSTALLER:
另开一个root用户窗口
[root@kes1 ~]# /opt/Kingbase/ES/V8/install/script/root.sh
Starting KingbaseES V8:
sys_ctl: another server might be running; trying to start server anyway
waiting for server to start.... stopped waiting
sys_ctl: could not start server
Examine the log output.
KingbaseES V8 did not start in a timely fashion, please see /data/Kingbase//sys_log/startup.log for details
有报错,查看startup日志
2024-08-19 00:32:38.260 EDT [32127] LOG: listening on IPv4 address "0.0.0.0", port 54321
2024-08-19 00:32:38.260 EDT [32127] LOG: listening on IPv6 address "::", port 54321
2024-08-19 00:32:38.262 EDT [32127] LOG: listening on Unix socket "/tmp/.s.KINGBASE.54321"
2024-08-19 00:32:38.314 EDT [32127] LOG: redirecting log output to logging collector process
2024-08-19 00:32:38.314 EDT [32127] HINT: Future log output will appear in directory "sys_log".
2024-08-19 04:32:50.810 GMT [32210] WARNING: max_connections should be less than or equal than 10 (restricted by license)
2024-08-19 04:32:50.810 GMT [32210] HINT: the value of max_connect is set 10
2024-08-19 04:32:50.811 GMT [32210] WARNING: max_connections should be less than or equal than 10 (restricted by license)
2024-08-19 04:32:50.811 GMT [32210] HINT: the value of max_connect is set 10
2024-08-19 00:32:50.812 EDT [32210] FATAL: lock file "kingbase.pid" already exists
2024-08-19 00:32:50.812 EDT [32210] HINT: Is another kingbase (PID 32127) running in data directory "/data/Kingbase"?
显示已经有kingbase进程了,初始化时就启动了?
[root@kes1 ~]# ps -ef | grep kingbase
root 29154 19503 0 00:04 pts/0 00:00:00 su - kingbase
kingbase 29155 29154 0 00:04 pts/0 00:00:00 -bash
root 30555 28736 0 00:18 pts/1 00:00:00 su - kingbase
kingbase 30556 30555 0 00:18 pts/1 00:00:00 -bash
kingbase 32127 1 0 00:32 ? 00:00:00 /opt/Kingbase/ES/V8/KESRealPro/V008R006C007B0024/Server/bin/kingbase -D /data/Kingbase
kingbase 32128 32127 0 00:32 ? 00:00:00 kingbase: logger
kingbase 32130 32127 0 00:32 ? 00:00:00 kingbase: checkpointer
kingbase 32131 32127 0 00:32 ? 00:00:00 kingbase: background writer
kingbase 32132 32127 0 00:32 ? 00:00:00 kingbase: walwriter
kingbase 32133 32127 0 00:32 ? 00:00:00 kingbase: autovacuum launcher
kingbase 32134 32127 0 00:32 ? 00:00:00 kingbase: stats collector
kingbase 32135 32127 0 00:32 ? 00:00:00 kingbase: kwr collector
kingbase 32136 32127 0 00:32 ? 00:00:00 kingbase: ksh writer
kingbase 32137 32127 0 00:32 ? 00:00:00 kingbase: ksh collector
kingbase 32138 32127 0 00:32 ? 00:00:00 kingbase: logical replication launcher
root 32712 30861 0 00:34 pts/2 00:00:00 grep --color=auto kingbase
后续再研究,至此,安装完成