Linux平台KingbaseES一键式修改操作系统参数脚本
·
#!/bin/bash
#file: enhance_os_param.sh
export LC_MESSAGES=C
# check current user ROOT
if [ "Xroot" != "X${USER}" ] && [ "X" != "X${USER}" ] ; then
echo "ERROR: This script should be executed by root, not the $USER."
exit 3
fi
if [ "X" == "X$1" ] ; then
_target_user="kingbase"
else
_target_user="$1"
fi
conf_exist=$(cat /etc/sysctl.conf | grep 'add by kingbase' | wc -l)
if [ $conf_exist -ne 0 ]; then
exit 0
fi
cat >> /etc/sysctl.conf <<EOF
#add by kingbase,from make_rwcmgr.sh
kernel.sem=5010 64128000 50100 1280
kernel.shmmni=8192
fs.file-max=7672460
vm.overcommit_memory=2
vm.overcommit_ratio=90
net.ipv4.ip_local_port_range=9000 65500
EOF
if [ -f /etc/sysctl.conf ];then
sysctl -p > /dev/null 2>&1
fi
cat >> /etc/security/limits.conf <<EOF
#add by kingbase
* soft nofile 655360
root soft nofile 655360
* hard nofile 655360
root hard nofile 655360
* soft nproc 655360
root soft nproc 655360
* hard nproc 655360
root hard nproc 655360
* soft core unlimited
root soft core unlimited
* hard core unlimited
root hard core unlimited
* soft memlock 50000000
root soft memlock 50000000
* hard memlock 50000000
root hard memlock 50000000
EOF
############# sshd
# comment old value line
sed -i "s/^GSSAPIAuthentication[ ]*/#GSSAPIAuthentication/g" /etc/ssh/sshd_config
sed -i "s/^UseDNS[ ]*/#UseDNS/g" /etc/ssh/sshd_config
sed -i "s/^UsePAM[ ]*/#UsePAM/g" /etc/ssh/sshd_config
# append new value line
echo "GSSAPIAuthentication no" >> /etc/ssh/sshd_config
echo "UseDNS no" >> /etc/ssh/sshd_config
echo "UsePAM yes" >> /etc/ssh/sshd_config
systemctl restart sshd 1>/dev/null 2>&1
service sshd restart 1>/dev/null 2>&1
############## shell
echo "shopt -s expand_aliases" >> /etc/bashrc
############## cron.allow
echo "${_target_user}" >> /etc/cron.allow
系统参数要求
在Linux平台中,为了避免在KingbaseES运行中出现由于操作系统设置不当从而导致系统异常的问题,产品为用户提供了一键式修改操作系统参数脚本。脚本位置在${ Default Install Folder}/Server/bin/enhance_os_param.sh
信息
- ${ Default Install Folder} 参数值为iso安装时的软件路径。
- 如果已经执行了${ Default Install Folder}/install/script/root.sh,则不需要执行此步骤。
手动执行修改操作系统参数步骤
使用root用户登录数据库服务器,执行以下命令
sh ${ Default Install Folder}/Server/bin/enhance_os_param.sh
补充说明:
enhance_os_param.sh脚本主要修改了以下操作系统配置内容
- 修改/etc/sysctl.conf参数文件
修改后值为:
#add by kingbase,from make_rwcmgr.sh
kernel.sem=5010 64128000 50100 1280
kernel.shmmni=8192
fs.file-max=7672460
vm.overcommit_memory=2
vm.overcommit_ratio=90
net.ipv4.ip_local_port_range=9000 65500
- 修改/etc/security/limits.conf参数文件
修改后值为:
#add by kingbase
* soft nofile 655360
root soft nofile 655360
* hard nofile 655360
root hard nofile 655360
* soft nproc 655360
root soft nproc 655360
* hard nproc 655360
root hard nproc 655360
* soft core unlimited
root soft core unlimited
* hard core unlimited
root hard core unlimited
* soft memlock 50000000
root soft memlock 50000000
* hard memlock 50000000
root hard memlock 50000000
- 修改/etc/ssh/sshd_config参数文件
修改后值为:
# append new value line
GSSAPIAuthentication no
UseDNS no
UsePAM yes
- 修改/etc/bashrc参数文件
修改后值为:
shopt -s expand_aliases
- 修改/etc/cron.allow参数文件
新加一行数据
${_target_user}
信息
${_target_user}为数据库部署用户
openEuler 是由开放原子开源基金会孵化的全场景开源操作系统项目,面向数字基础设施四大核心场景(服务器、云计算、边缘计算、嵌入式),全面支持 ARM、x86、RISC-V、loongArch、PowerPC、SW-64 等多样性计算架构
更多推荐


所有评论(0)