Hi,
I installed Mosquitto a few months ago to communicate between instances of Node-Red environments.
A few days ago the MQTT messages stopped. I rebooted my Debian 11 server on which Mosquitto is installed and it worked again. The issue happened again about 24 hours later, and so on.
I investigated and found an error that implied there were too many open files, so I added the following line to /usr/lib/systemd/system/mosquitto.service:
[Service]
LimitNOFILE=49152
then ran these…
sudo systemctl daemon-reload
sudo service mosquitto stop
sudo service mosquitto start
I ran the code below, after a restart to see the count of open connections:
sudo netstat -natp | grep ESTABLISHED.*mosquitto | wc -l
It stood at 348, which makes sense as I probably have about that many nodes in NR communicating between the Node-Red environments (that is, between the Debian 11 server and 3x Pis + the Debian server itself)
The issue happened again, this time maybe only 1 hour later. someone on the Node-Red forum suggested doing the following:
sudo service mosquitto stop
sudo rm /var/lib/mosquitto/mosquitto.db
sudo service mosquitto start
I did the above and the problem has not happened in over 24 hours. It appears to have gone away, however when I checked earlier today for the number of open files, it had increased to 3,046.
I ran this to see the list of connections
sudo netstat -ntp | grep ESTABLISHED.*mosquitto
But the results are pretty dull, just a very long list …
Can someone please direct me as to how I can dig deeper to find out why more and more open files are being created, or confirm if this is expected behaviour?
… I am splitting messages up to overcome the embedded media restriction for new users