
我在 Debian 8 上遇到了 Asterisk 13.11.2 的問題,它在達到開啟檔案的限制後崩潰
bridge_channel.c: Can't create pipe! Try increasing max file descriptors with ulimit -n
我已成功使用以下命令將限制從 65536 增加到 150000/etc/security/limits.conf
我添加了以下內容:
root soft nofile 150000
root hard nofile 150000
* soft nofile 150000
* hard nofile 150000
現在的結果ulimit -n
是 150000
當我嘗試檢查星號進程的限制時cat /proc/xxx/limits
我仍然得到舊的限制!
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 31945 31945 processes
Max open files 1024 4096 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 31945 31945 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
怎麼解決這個問題呢?
答案1
取消註釋並更改 /usr/sbin/safe_asterisk 中 MAXFILES 的值
例如:最大檔案數 = 150000
儲存檔案並重新啟動星號
完畢
答案2
我懷疑您的系統正在使用忽略/etc/security/limits.conf
.相反,您必須在星號服務文件(/etc/systemd/system/asterisk.service
或/lib/systemd/system/asterisk.service
)中配置這些限制。您可能想要新增
LimitNOFILE=150000
請注意,您可能不想編輯 Asterisk 附帶的文件,因為您可能會遇到更改被下一次 Asterisk 更新覆蓋的風險。相反,我建議使用/etc/systemd/system/asterisk.d/10-file-descriptors.conf
上面的行來建立一個文件。然後 Systemd 將自動使用您的配置來擴充官方服務文件。