CentOS 7 系统参数调优说明

  1. 简介
    Centos 7 操作系统的默认句柄数很小,无法维持推送系统的需求,所以需要修改内核参数来增大句柄数的限制,以此来满足需求。
  2. 环境
    Centos 7, 64 bit
  3. 配置说明
    如下参数配置过程只在centos 7的64 bit版本上验证过,linux各个派系、不同版本的操作系统并不保证兼容性。请一定注意。
    1) 终端输入 vi /etc/sysctl.conf 打开配置文件,将下列内容复制进文件,然后按ESC键,输入 :wq 保存。如果某些参数已经存在,记得要覆盖之。
    net.ipv4.ip_local_port_range = 1024 65535
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    net.ipv4.tcp_rmem = 4096 87380 16777216
    net.ipv4.tcp_wmem = 4096 65536 16777216
    net.ipv4.tcp_fin_timeout = 10
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_timestamps = 0
    net.ipv4.tcp_window_scaling = 0
    net.ipv4.tcp_sack = 0
    net.core.netdev_max_backlog = 30000
    net.ipv4.tcp_no_metrics_save = 1
    net.core.somaxconn = 22144
    net.ipv4.tcp_syncookies = 0
    net.ipv4.tcp_max_orphans = 262144
    net.ipv4.tcp_max_syn_backlog = 262144
    net.ipv4.tcp_synack_retries = 2
    net.ipv4.tcp_syn_retries = 2
    vm.overcommit_memory = 1
    fs.file-max = 2000000
    fs.nr_open = 2000000
    2) 终端输入 vi /etc/security/limits.conf 打开配置文件,配置如下两项后,按ESC键,输入 :wq 保存。
    • soft nofile 1200000
    • hard nofile 1200000
      3) 终端输入 systemctl disable firewalld 来禁止防火墙的开机启动项,再输入 systemctl stop firewalld 关闭防火墙,关闭完可以用 firewall-cmd –state 来查看当前状态,若显示 not running 表示关闭成功。
      4) 终端输入 reboot 重启电脑,使上述配置项生效。

猜你喜欢

转载自blog.csdn.net/github_35707894/article/details/79831216