2017-03-03 22 views
9

我想增加Rabbitmq服務器的文件描述符。無法增加rabbitmq的文件描述符

機的詳細信息:

[email protected]:/home/# uname -a 
Linux rabbitmq-stats-node 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u1 (2017-02-22) x86_64 GNU/Linux 

下面是配置參數的細節變化:

[email protected]:/home/# cat /proc/sys/fs/file-max 
500000 

[email protected]:/home/# tail -n1 /etc/pam.d/common-session 
session required pam_limits.so 

[email protected]:/home/# tail -n1 /etc/pam.d/common-session-noninteractive 
session required pam_limits.so 

[email protected]:/home/# tail -n4 /etc/security/limits.conf 
*   soft nofile   65536 
*   hard nofile   500000 
root   soft nofile   65536 
root   hard nofile   500000 

[email protected]:/home/# sysctl -p 
fs.file-max = 500000 

[email protected]:/home/# sudo service rabbitmq-server restart 

[email protected]:/home/# sudo reboot 

所有配置更改後,我無法更改文件desciptors限制。

[email protected]:/home/# rabbitmqctl status | grep -A1 descriptors 
{file_descriptors, 
    [{total_limit,924},{total_used,13},{sockets_limit,829},{sockets_used,3}]}, 

我可以看到變化的限制,當我進入,

[email protected]:/home/# ulimit -n 
65536 

雖然變化不會反映在RabbitMQ的安裝。

我也嘗試添加ulimit行到/usr/lib/rabbitmq/bin/rabbitmq-env文件。儘管rabbitmq服務器在添加此更改後未啓動。錯誤拋出:

ulimit: error setting limit (Operation not permitted) 

回答

0

實際進行快速測試,將我的用戶運行(讓我們叫他my_user)的RabbitMQ來在/etc/security/limits.conf如下:

my_user   soft nofile   65000 
my_user   hard nofile   65000 

然後再次登錄並返回,從rabbitmq開始,檢查文件描述符的數量,我獲得:

{file_descriptors, 
    [{total_limit,64900},... 

所以我可以得出結論,它的工作原理。現在我非常懷疑你寫的是運行rabbitmq的用戶不是root用戶,而是另一個用戶。然而,最大文件描述符的增加似乎只適用於root用戶,因此運行rabbitmq並沒有任何區別。

要檢查它更詳細,這將是很好,你發佈了「服務」的劇本跑,當你進入:

sudo service rabbitmq-server restart 

現在如果你想確保你的修改工作,你可以直接啓動作爲的RabbitMQ根(我不推薦用於生產)