Столкнулся с ошибкой To many open files на nginx. Операционная система Centos 7, почему обращаю внимание на операционную систему? Все рекомендации, которые я применял не имели положительного эффекта, так как в основном применялись для Ubuntu. На Centose же они не подходят.
Create file /etc/systemd/system/nginx.service.d/override.conf with the following contents:
[Service]
LimitNOFILE=65536
Reload systemd daemon with:
systemctl daemon-reload
Add this to Nginx config file:
worker_rlimit_nofile 16384; (has to be smaller or equal to LimitNOFILE set above)
And finally restart Nginx:
systemctl restart nginx
You can verify that it works with cat /proc/<nginx-pid>/limits.
Также привожу скрипт для вывода open files для nginx
for pid in `pidof nginx`; do echo "$(< /proc/$pid/cmdline)"; egrep 'files|Limit' /proc/$pid/limits; echo "Currently open files: $(ls -1 /proc/$pid/fd | wc -l)"; echo; done
Create file /etc/systemd/system/nginx.service.d/override.conf with the following contents:
[Service]
LimitNOFILE=65536
Reload systemd daemon with:
systemctl daemon-reload
Add this to Nginx config file:
worker_rlimit_nofile 16384; (has to be smaller or equal to LimitNOFILE set above)
And finally restart Nginx:
systemctl restart nginx
You can verify that it works with cat /proc/<nginx-pid>/limits.
Также привожу скрипт для вывода open files для nginx
for pid in `pidof nginx`; do echo "$(< /proc/$pid/cmdline)"; egrep 'files|Limit' /proc/$pid/limits; echo "Currently open files: $(ls -1 /proc/$pid/fd | wc -l)"; echo; done
Комментариев нет:
Отправить комментарий