Rabbitmq 文档说我们需要在生产中使用它之前进行一些配置.其中一个配置是关于最大打开文件数(这是一个操作系统参数).
Rabbitmq documentation says that we need to do some configuration before we use it on production. One of the configuration is about maximum open file number (which is an OS parameter).
我们使用的 Rabbitmq 服务器在 Ubuntu 16.04 上运行,根据我在网上找到的资源,我将打开的文件数更新为 500k.当我从命令行检查它时,我得到以下输出:
Rabbitmq server we use is running on Ubuntu 16.04 and according to resources I found on web, I updated the number of open files as 500k. When I check it from command line, I get the following output:
root@madeleine:~# ulimit -n 500000然而,当我查看 rabbitmq 服务器状态时,我看到了另一个数字.
However when I look at the rabbitmq server status, I see another number.
root@madeleine:~# rabbitmqctl status | grep 'file_descriptors' -A 4 {file_descriptors, [{total_limit,924}, {total_used,19}, {sockets_limit,829}, {sockets_used,10}]},看起来,我设法增加了操作系统端的限制,但 rabbitmq 仍然认为文件描述符的总限制是 924.
It seems like, I managed to increase the limit on OS side, but rabbitmq still thinks that total limit of file descriptors is 924.
可能导致此问题的原因是什么?
What might be causing this problem?
推荐答案你可能想看看这个 页面
显然,此操作取决于操作系统版本.如果您有 systemd,您应该在 /etc/systemd/system/rabbitmq-server.service.d/limits.conf 文件中执行以下操作:
Apparently, this operation depends on the OS version. If you have a systemd, you should do the following in /etc/systemd/system/rabbitmq-server.service.d/limits.conf file:
请注意,根据您使用的操作系统,此服务配置可能位于其他位置.您可以使用以下命令查找此服务配置所在的位置并更新该文件.
find / -name "*rabbitmq-server.service*"[服务]
LimitNOFILE=300000
另一方面,如果你没有 systemd 文件夹,你应该在你的 rabbitmq-env.conf 文件中试试这个:
On the other hand, if you do not have the systemd folder, you should try this in your rabbitmq-env.conf file:
ulimit -S -n 4096
更多推荐
Rabbitmq 文件描述符限制
发布评论