1.背景
正式环境多个用户登录频繁报网络错误
2.排查及解决
## 查看error.log 发现原因是 Too many open files
## ulimit -a命令可以查看单个进程最大打开文件的数量限制;默认1024
## 统计指定进程打开的文件数,发现都在1024以内
lsof -p pid | wc -l
## 尝试修改nginx.conf
worker_processes auto;
events {
worker_connections 20480;
}
## 重启nginx
nginx -t # 检查配置文件是否正确
nginx -s reload # 重新加载配置文件
3.引用
Linux查看文件打开数量
nginx 报 accept4() failed (24: Too many open files)
服务器报accept4 () failed (24: Too many open files)错误解决方法
4.安装lsof
# 下载rpm包 https://rpmfind.net/linux/rpm2html/search.php?query=lsof&submit=Search+...&system=centos&arch=x86_64
# 安装,自动检查依赖包是否齐全
sudo yum -y localinstall lsof-4.87-6.el7.x86_64.rpm
标签:x86,查看,指定,nginx,64,linux,4.87,lsof,el7 From: https://www.cnblogs.com/route/p/18089565Loaded plugins: fastestmirror
Examining lsof-4.87-6.el7.x86_64.rpm: lsof-4.87-6.el7.x86_64
Marking lsof-4.87-6.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package lsof.x86_64 0:4.87-6.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
......
Installing : lsof-4.87-6.el7.x86_64 1/1
Verifying : lsof-4.87-6.el7.x86_64 1/1
Installed:
lsof.x86_64 0:4.87-6.el7