I want to know who to adjust quantity of the socket descriptors?
In additi
The solution which worked for me on Ubuntu is this:
First, find the correct rabbitmq-server
file. You can do this by running locate rabbitmq-server
on the bash prompt.
Then open the file with sudo vim /etc/default/rabbitmq-server
. It is a file which will contain the line ulimit -n 4096
.
If the line is commented out with a #
, uncomment the line.
Then add EOF
as the last line of the file.
The file will now appear like this:
# This file is sourced by /etc/init.d/rabbitmq-server. Its primary
# reason for existing is to allow adjustment of system limits for the
# rabbitmq-server process.
#
# Maximum number of open file handles. This will need to be increased
# to handle many simultaneous connections. Refer to the system
# documentation for ulimit (in man bash) for more information.
#
ulimit -n 4096
EOF
Now you have to restart rabbitmq. Don't restart the operating system though.
Locate your rabbitmqctl
file and run:
sudo /usr/sbin/rabbitmqctl stop
Then start rabbitmq again either with sudo /usr/sbin/rabbitmqctl start &
.
That's it. Now go to the RabbitMQ Browser UI, and you'll see that the number of sockets have increased.
Looks like you have to change max opened file descriptors in your system.
From RabbitMQ installation manual for Debian and Ubuntu systems, section Controlling system limits:
RabbitMQ installations running production workloads may need system limits and kernel parameters tuning in order to handle a decent number of concurrent connections and queues. The main setting that needs adjustment is the max number of open files, also known as ulimit -n. The default value on many operating systems is too low for a messaging broker (eg. 1024 on several Linux distributions). We recommend allowing for at least 65536 file descriptors for user rabbitmq in production environments. 4096 should be sufficient for most development workloads.
There are two limits in play: the maximum number of open files the OS kernel allows (fs.file-max) and the per-user limit (ulimit -n). The former must be higher than the latter.
The most straightforward way to adjust the per-user limit for RabbitMQ is to edit the /etc/default/rabbitmq-server (provided by the RabbitMQ Debian package) or rabbitmq-env.conf to invoke ulimit before the service is started.
ulimit -S -n 4096
This soft limit cannot go higher than the hard limit (which defaults to 4096 in many distributions). The hard limit can be increased via /etc/security/limits.conf. This also requires enabling the pam_limits.so module and re-login or reboot.
Note that limits cannot be changed for running OS processes.
For more information about controlling fs.file-max with sysctl, please refer to the excellent Riak guide on open file limit tuning.
P.S.:
The similar issue was discussed in RabbitMQ mailing list "Increasing the file descriptors limit". The last message contains final link to the RabbitMQ installation document and explicitly point to ulimit issue, but reading through it also may help you to deal with you problem while the whole thread covers the descriptors limit issue from different points.
I am running RabbitMQ 3.6.3 on Ubuntu 16.04 and with those newer versions the answer given here (using ulimit in the rabbitmq-server file) no longer worked for me.
The solution for me was to configure the limits for systemd in this file
/etc/systemd/system/rabbitmq-server.service.d/override.conf
In that file, put this configuration
[Service]
LimitNOFILE=32768
Where 32768 is the number of file handles you want to configure.
If you edit that file directly, you'll need to reload the systemd configuration with
sudo systemctl daemon-reload
But you can also use systemctl to edit the file, in which case it reloads the configuration automatically
sudo systemctl edit rabbitmq-server
you can add following line in /etc/security/limits.conf
* soft nofile 65000
* hard nofile 65000
with this you set ulimit to 65000
I noticed the other answers here do answer the question of how to raise the limit of socket descriptors (setting ulimit -n <value>
in /etc/default/rabbitmq-server
), but none of them answered your other question (Why 829 socket descriptors when the file descriptor limit is 1024?)
This is due to the number of other file handles that RabbitMQ is using. You will always have a lower number of socket descriptors by some degree (From my own usage, it's around 90-95% of the file descriptor limit). RabbitMQ's documentation provides the recommendation that you set your file descriptor limit to 1.5 times the number of connections you expect to have at a maximum: Tuning For A Large Number of Connections