Rabbitmq 文件描述符限制 [英] Rabbitmq File Descriptor Limit

查看:129
本文介绍了Rabbitmq 文件描述符限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 文件描述符限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆