多年前的笔记-CenetOS6.7内核优化
文章目录
备份
[ -f /etc/sysctl.conf ] && cp -av /etc/sysctl.conf{,_bak}
优化内核
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 = 3276800
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_wmem = 51200 131072 204800
net.ipv4.tcp_rmem = 51200 131072 204800
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.ip_conntrack_max = 65536
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 16384
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_mem = 94500000 915000000 927000000
EOF
sysctl -p
优化文件描述符数量
cat > /etc/security/limits.conf<<EOF
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
EOF
cat > /etc/security/limits.d/90-nproc.conf<<EOF
* soft nproc 65535
EOF
Centos开机启动优化
### for centos6.7 64bit simple chinese
### by hanyanwei
### 2015-11-01
for i in `chkconfig --list |grep 3:on|awk '{print $1}'|egrep -v "network|sshd"`;do chkconfig $i off;done
chkconfig --list |grep 3:on
设置显示主机全名
echo "PS1='[\u@\H \W]'" >>/etc/profile
. /etc/profile
内核优化已完成
#by hanyanwei 2015-11-06
sysctl -p
标签:sysctl,笔记,etc,CenetOS6.7,内核,conf,chkconfig,优化
From: https://blog.csdn.net/weixin_36518466/article/details/137402363