https://www.runoob.com/linux/linux-tutorial.html

4、系统优化
4.1、配置主机时间、时区、系统语言

查看时区

[root@rancher]# date -R 或者 timedatectl

修改时区

[root@rancher]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

修改系统语言环境

[root@rancher]# sudo echo 'LANG="en_US.UTF-8"' >> /etc/profile;source /etc/profile

配置主机NTP时间同步

4.2、Kernel 性能调优

通过如下命令进行宿主机内核性能调优,实际参数数值根据实际环境自行配置,最后执行sysctl -p保存配置。

cat >> /etc/sysctl.conf<<EOF
vm.max_map_count = 6553000
vm.swappiness = 1
fs.file-max = 100000000
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv4.neigh.default.gc_stale_time = 120
kernel.msgmnb = 65536
kernel.msgmax = 65536
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.neigh.default.gc_thresh1 = 4096
net.ipv4.neigh.default.gc_thresh2 = 6144
net.ipv4.neigh.default.gc_thresh3 = 8192
EOF

然后重新加载 sysctl.conf 即可

$ sudo sysctl -p
4.2、Kernel 性能调优
cat >> /etc/security/limits.conf<<EOF
* soft nofile 655360
* hard nofile 655360
* soft nproc 655360
* hard nproc 655360
EOF
作者:Jeebiz  创建时间:2020-01-12 14:03
 更新时间:2024-08-20 17:39