【发布时间】:2016-11-03 06:02:46
【问题描述】:
我可以看到为这个问题创建了更多线程。尝试了这些线程上提到的所有解决方案。但是没有一个选项对我有用。所以我正在创建这个新线程。
操作系统:CentOS 7.2.1511
Nginx:1.10.0
错误信息:
Nov 2 23:21:36 localhost nginx: Starting nginx: nginx: [emerg] socket() x.x.x.x:80 failed (24: Too many open files)
Nov 2 23:21:36 localhost nginx: [FAILED]
Nov 2 23:21:36 localhost systemd: nginx.service: control process exited, code=exited status=1
Nov 2 23:21:36 localhost systemd: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
Nov 2 23:21:36 localhost systemd: Unit nginx.service entered failed state.
Nov 2 23:21:36 localhost systemd: nginx.service failed.
极限值:
[root@serv1 nginx]# ulimit -n
16000
[root@serv1 nginx]#
Sysctl.conf:
fs.file-max = 752415
nginx.conf:
worker_rlimit_nofile 30000;
nginx 用户限制:
[nginx@serv1 ~]$ ulimit -Sn
16000
[nginx@serv1 ~]$ ulimit -Hn
16000
[nginx@serv1 ~]$
Nginx PID max 打开文件限制:
Max open files 1024 4096 files
不确定,为什么打开文件限制没有反映到 nginx 进程。当我从 proc 目录中检查 pid 限制值时。如上所述,它显示默认值。软限制和硬限制的值都应为 16000。
另外,我检查了服务器上 nginx 进程的 openfiles 限制。它不会超过 1042。
打开文件:
[root@serv1 ~]# ps -ef | grep nginx
root 4285 1 0 23:12 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/conf/nginx/nginx.conf
nginx 4286 4285 0 23:12 ? 00:00:00 nginx: worker process
root 4308 4290 0 23:12 pts/1 00:00:00 grep --color=auto nginx
[root@serv1 ~]# lsof -p 4285 | wc -l
1042
[root@serv1 ~]#
请有人帮我解决这个问题。谢谢。
【问题讨论】: