nginx报错:‘open too many files’解决
nginx 出错:socket() failed (24: Too many open files) while connecting to upstream
1. 错误描述
通过nginx负载两个节点的rabbitmq
当用java代码创建超过500个连接时(我的机器默认只能创建这么多),出现错误:
com.rabbitmq.client.ShutdownSignalException: connection error
java.net.SocketException: Software caused connection abort: recv failed
查看nginx日志/var/log/nginx/error.log,发现错误
socket() failed (24: Too many open files) while connecting to upstream
解决
修改linux打开文件句柄数,编辑vi /etc/security/limits.conf,添加
<domain> <type> <item> <value>
* soft nofile 204800
* hard nofile 204800
修改nginx打开文件数, 编辑nginx.conf,添加worker_rlimit_nofile值
worker_processes 1;
worker_rlimit_nofile 20480;
重启nginx后问题解决
————————————————
版权声明:本文为CSDN博主「可还记得你我的誓言」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u013231970/article/details/100102852