Dusting off the blood sucker – deleting sustained mosquitto messages

After expermienting alot with my MQTT server it was pretty polluted with sustained messages and I wanted to get rid of them. The fastest way I got this reliably to work was by deleting the persistence file while the MQTT server was offline. You could delete all or specific topics with a script, too, but as this didn’t work as I wanted it to, this is the way (for now).

sudo service mosquitto stop

sudo rm /var/lib/mosquitto/mosquitto.db

sudo service mosquitto start

The path to the persistence file could be different on your system, so you can try:

sudo find / -name mosquitto.db

Try the above with the found path.

Similar Posts

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.