内核参数配置模版
内核配置文件模版
参考服务器配置16c32g
# source route controls
net.ipv4.conf.default.rp_filter=1
net.ipv4.ip_nonlocal_bind=1
net.ipv4.ip_forward=1
# don't accept source routing
net.ipv4.conf.default.accept_source_route=0
# use tcp syncookie
net.ipv4.tcp_syncookies=1
# tcp kernel paramater
net.ipv4.tcp_mem=786432 1048576 1572864
net.ipv4.tcp_rmem=4096 87380 4194304
net.ipv4.tcp_wmem=4096 16384 4194304
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_sack=1
# socket buffer
net.core.wmem_default=8388608
net.core.rmem_default=8388608
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.core.netdev_max_backlog=262144
net.core.somaxconn=20480
net.core.optmem_max=81920
# tcp conn
net.ipv4.tcp_max_syn_backlog=262144
net.ipv4.tcp_syn_retries=3
net.ipv4.tcp_retries1=1
net.ipv4.tcp_retries2=15
#端口复用依赖与timestamps的开启
# tcp conn reuse
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_fin_timeout=1
net.ipv4.tcp_max_tw_buckets=20000
net.ipv4.tcp_max_orphans=3276800
net.ipv4.tcp_syncl_retries=1
#对每个ip报文打上时间标记,当负载均衡服务器打开时,短时间内同一个ip多次访问,可能会把ip的请求丢弃,所以负载均衡主机要关闭此参数
#net.ipv4.tcp_timestamps=1 #?
# keepalive conn
net.ipv4.tcp_keepalive_time=300
net.ipv4.tcp_keepalive_intvl=30
net.ipv4.tcp_keepalive_probes=3
net.ipv4.ip_local_port_rang=10001 65000
# lvs configure
#net.ipv4.conf.eth0.rp_filter=0
#net.ipv4.conf.lo.arp_ignore=1
#net.ipv4.conf.lo.arp_announce=2
#net.ipv4.conf.all.arp_ignore=1
#net.ipv4.conf.all.arp_announce=2
# disable netfilter on birdges
net.bridge.bridge-nf-call-ip6tables=0
net.bridge.bridge-nf-call-iptables=0
net.bridge.bridge-nf-call-arptables=0
# swap
vm.overcommit_memory=0
vm.swappiness=10
# system request debug of kernel
kernel.sysrq=0
# dumps controls
kernel.core_uses_pid=1
# kernel: mesage queue max size
kernel.msgmnb=65536
# kernel: a mesage max size,in bytes
kernel.msgmax=65536
# shared segment max size,in bytes
kernel.shmmax=68719476736
# shared memory segment max number,in pages
kernel.shmall=4294967296
vm.max_map_count=524288
fs.file-max=1000000

浙公网安备 33010602011771号