同步时间
yum -y install ntp
/usr/sbin/ntpdate cn.pool.ntp.org
禁用SELinux
# 临时禁用
setenforce 0
# 永久禁用
sed -i 's/=enforcing/=disabled/' /etc/sysconfig/selinux
sed -i 's/=enforcing/=disabled/' /etc/selinux/config
# 查看(原先:Enforcing,设置后:Permissive)
getenforce
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
systemctl list-unit-files | grep firewalld
内核生产环境优化参数
参考1:CentOS内核参数优化参考
参考2:Centos 7系统优化脚本
参数3:linux内核参数注释与优化
cat >> /etc/sysctl.conf << EOF
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl =15
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_orphans = 32768
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_wmem = 8192 131072 16777216
net.ipv4.tcp_rmem = 32768 131072 16777216
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.ip_local_port_range = 1024 65000
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 16384
EOF
/sbin/sysctl -p
不生效(CentOS Linux release 7.8.2003 (Core))
net.ipv4.ip_conntrack_max = 65536
net.ipv4.netfilter.ip_conntrack_max=65536
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=180
网友评论