修改系统配置项

CentOS 8.1系统下执行该章节操作,其他系统下无需执行。
修改limits.conf
- 编辑“/etc/security/limits.conf”配置文件。
1
vim /etc/security/limits.conf
- 按“i”进入编辑模式,文件末尾添加如下配置。
1 2 3 4
* soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
重启系统
- 重启系统使前面的修改生效。
1
reboot
- 确认修改生效。
1
sestatus
1
ulimit -n
优化内核参数
- 编辑“/etc/sysctl.conf”配置文件。
1
vim /etc/sysctl.conf
- 按“i”进入编辑模式,增加配置。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
kernel.shmmax = 500000000 kernel.shmmni = 4096 kernel.shmall = 4000000000 kernel.sem = 250 512000 100 2048 kernel.sysrq = 1 kernel.core_uses_pid = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.msgmni = 2048 net.ipv4.tcp_syncookies = 1 net.ipv4.ip_forward = 0 net.ipv4.conf.default.accept_source_route = 0 net.ipv4.tcp_max_syn_backlog = 4096 net.ipv4.conf.all.arp_filter = 1 net.ipv4.ip_local_port_range = 1025 65535 net.core.netdev_max_backlog = 10000 net.core.rmem_max = 2097152 net.core.wmem_max = 2097152 vm.overcommit_memory = 2
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 配置生效。
1
sysctl -p
父主题: 配置编译环境