Icecast - 打开的文件太多

Icecast - Too many open files

我是 运行 CentOS 7 上的 Icecast 2.4.3 服务器。当我有很多听众时,我收到这些错误并且一切都停止工作:

[2017-06-21  18:56:37] WARN connection/_accept_connection accept() failed with error 24: Too many open files

运行 "ices" 用户:

sudo -u ices /opt/icecast/bin/icecast -c /opt/icecast/etc/icecast.xml -b

或 运行 以 root 身份向 "ices" 用户提供 "changeowner" 选项。

我设置limits.conf:

ices         hard    nofile      65536
ices         soft    nofile      65536

来自 ulimit:

[root@orfeu inweb]# su ices
[ices@orfeu inweb]$ ulimit -n
65536

但是当我检查 PID 时,我得到:

tcp        0      0 <IP>:8000       0.0.0.0:*               LISTEN      21650/icecast

[root@orfeu inweb]# cat /proc/21650/limits
Limit                     Soft Limit           Hard Limit           Units
...
Max open files            1024                 4096                 files
...

我该如何解决这个问题,强制使用 65536 个文件描述符?谢谢。

可能我找到了解决办法。需要检查何时再次出现问题。

我知道 limits.conf 设置了限制 每个用户 。 我找到了一种方法来设置每个进程的限制

/usr/bin/prlimit -n30000 -p `cat /var/run/icecast.pid`

现在我有:

Max open files            30000                30000                files

我不知道是否有办法始终以这些限制启动 "icecast" 二进制文件,或者总是需要 运行 在 运行 之后针对 PID 执行命令。