系统环境
1 2
| CentOS Linux release 7.6.1810 (Core) Linux 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
|
临时更改最大打开文件描述符数
1 2 3 4 5
| # ulimit -n
# ulimit -n 1048576
|
永久更改最大打开文件描述符数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| # vim /etc/security/limits.conf * soft nofile 1048576 * hard nofile 1048576
# vim /etc/sysctl.conf fs.file-max = 1048576
# vim /etc/pam.d/login session required pam_limits.so
# reboot
# ulimit -n # sysctl fs.file-max # cat /proc/PID/limits
|
更改 Supervisor 的最大打开文件描述符数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
# vim /etc/supervisord.conf [supervisord] minfds=1048576
# vim /usr/lib/systemd/system/supervisord.service [Service] LimitNOFILE=1048576
# systemctl daemon-reload # systemctl restart supervisord
|
更改 MySQL(RPM 方式安装)的最大打开文件描述符数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
# cat /proc/`pidof mysqld`/limits # egrep '^(Limit|Max open files)' /proc/`pidof mysqld`/limits
# vim /usr/lib/systemd/system/mysqld.service LimitNOFILE=1048576
# mkdir /usr/lib/systemd/system/mysqld.service.d # vim /usr/lib/systemd/system/mysqld.service.d/override.conf [Service] LimitNOFILE=1048576
# systemctl daemon-reload # systemctl restart mysqld
|