KingbaseES安装前OS内核参数修改(限性能测试或高并发下建议设置)
配置内核参数
[[email protected] ~]# vi /etc/sysctl.conf
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 2500 320000102420480
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
修改好内核参数后,执行如下命令使新的设置生效
[[email protected] ~]# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
创建并添加kingbase组和用户修改相应权限
[[email protected] ~]# groupadd kingbase
[[email protected] ~]# useradd kingbase -g kingbase -m
[[email protected] ~]# passwd kingbase
[[email protected] home]# chmod -R 755 kingbase
[[email protected] home]# chown -R kingbase:kingbase kingbase
配置kingbase用户环境变量
[[email protected] ~]$ vi .bash_profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/kingbase/KingbaseES/lib:/home/kingbase/KingbaseES/bin:/home/kingbase/KingbaseES/unixodbc/lib
添加以下内容到/etc/security/limits.conf
[[email protected] ~]# vi /etc/security/limits.conf
kingbase soft nproc 2047
kingbase hard nproc 16384
kingbase soft nofile 1024
kingbase hard nofile 65536
//一般来说,出于性能上的考虑,还需要需要进行如下的设定,以便改进kingbase用户的有关体验,nproc(单个用户可用的最大进程数量), nofile(可打开的文件描述符的最大数)。soft是软限制 ,hard是硬限制,用户可以超过这个设置的值,但一定不能超过hard 的值 。一般soft比hard小。
添加以下内容到/etc/pam.d/login
[[email protected] ~]# vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
要使 limits.conf 文件配置生效,必须要确保 pam_limits.so 文件被加入到启动文件中。查看 /etc/pam.d/login 文件中有:
session required /lib/security/pam_limits.so
添加以下内容到/etc/profile
[[email protected] ~]# vi /etc/profile
if [ $USER = "kingbase" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
将KingbaseES软件从windows中传至Linux中并解压
[[email protected] ~]# ls
anaconda-ks.cfg install.log.syslog
Desktop kdb-7.1.2.0363-release-Linux-x86_64-installer-build0032.zip
install.log license_ee_7.1.2_企业版180L64.dat
[[email protected] kingbase]# unzip kdb-7.1.2.0363-release-Linux-x86_64-installer-build0032.zip
[[email protected] kingbase]# su - kingbase
[[email protected] ~]$ cd /home/kingbase/
[[email protected] ~]$ ls
kdb-7.1.2.0363-release-Linux-x86_64-installer-build0032.zip setup
license_ee_7.1.2_企业版180L64.dat setup.sh
[[email protected] ~]$ mkdir /home/kingbase/kingbaseES
[[email protected] ~]# xhost +
access control disabled, clients can connect from any host
[[email protected] ~]# xclock 出现小时中则正常
[[email protected] ~]$ ./setup.sh
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...
这里选择完全安装
证书选择
确认后开始安装,期间会提示远程账号,默认krms,密码krms,这里直接下一步
选择完成
切换到root用户执行Root.sh(Linux特有步骤)
[[email protected] ~]$ su -
口令:
[[email protected] kingbaseES]# cd /home/kingbase/kingbaseES/Install/
[[email protected] Install]# ls
Root.sh servicemgmt.sh startup-desktop
[[email protected] Install]# ./Root.sh
Installing ODBC driver...
ODBC Driver is installed successfully!
Installing krms7d...
krms7d is installed successfully!
krms7d is starting...
starting krms[确定]
成功启动krms服务。
krms7d start successfully!
Installing kingbase7d...
kingbase7d is installed successfully!
Installing jobmgmt7d...
jobmgmt7d is installed successfully!
Installing kdbws7d...
kdbws7d is installed successfully!
kdbws7d is starting...
kdbws7d is starting[确定]
kdbws7d start successfully!
Starting to initialize database by kingbase ...
Complete.
初始化数据库
检查下4个进程的启动情况
[[email protected] ~]$ /etc/init.d/krms7d status
krms of kingbase: running[确定]
[[email protected] ~]$ /etc/init.d/kingbase7d status
kingbase kingbasees_instance1 of kingbase: running[确定]
[[email protected] ~]$ /etc/init.d/jobmgmt7d status
job_manager kingbasees_instance1 of kingbase: not running[警告]
[[email protected] ~]$ /etc/init.d/kdbws7d status
kdbws7d (pid 10497) is running......[确定]
启动数据库
[[email protected] ~]$ isql -U SYSTEM -W beijing TEST //-U表示用户 -W表示密码 TEST为数据库名
欢迎使用 isql 7.1.2.0363 release 64 bit, Kingbase 交互式终端.
类型: \h SQL帮助命令
\? isql帮助命令
\g 将之前的SQL语句发往服务器执行
\q 退出
TEST=#