Centos 6.X 系统优化脚本

内核参数优化

modprobe bridge
cat >>/etc/sysctl.conf<<EOF
vm.swappiness = 0
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_keepalive_time =600
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 16384
net.ipv4.tcp_max_orphans = 16384
net.ipv4.ip_local_port_range = 1024    65000
EOF
cat /etc/sysctl.conf
sysctl -p

启动进程优化

chkconfig --list|grep 3:on
for sun in `chkconfig --list|grep 3:on|awk '{print $1}'`;do chkconfig --level 3 $sun off;done
for sun in crond rsyslog sshd network salt-minion snmpd zabbix_agentd;do chkconfig --level 3 $sun on;done
chkconfig --list|grep 3:on

系统描述符优化

ulimit -n
echo '*  -  nofile  65535' >> /etc/security/limits.conf
ulimit -n

开机优化

cat >>/etc/rc.local<<EOF
modprobe bridge
ulimit -HSn 65535
ulimit -s 65535
EOF


本文出自 “devops” 博客,谢绝转载!

你可能感兴趣的:(linux,centos,调优,系统优化)