这是因为linux限制了打开文件的最大句柄数量。
linux默认的打开文件数量是1024,我们可以用ulimit -a 来查看系统资源,例如:
也可以通过ulimit -n 查看
通过ulimit -n 65535 可以临时设置。
永久的设置的话需要修改配置文件:
通过VI打开/etc/security/limits.conf,在“# End of file”上面添加如下:
* soft nofile 65536
* hard nofile 65536
* - nofile 65536 该语句表示:每一个用户的默认打开文件数是65536
通过VI打开/etc/sysctl.conf,在最后一行添加如下:
fs.file-max = 65536
然后reboot重启服务器搞定