philipp
philipp

Reputation: 16515

Mosquitto—restore persitence file

I have installed the mqtt server mosquitto on a RPi3 and everything was working. I tried to clear all the persistence like so:

sudo cat /dev/null > /var/lib/mosquitto/mosquitto.db

After that the server did not start anymore and I had to disable persistence to get it up an running again.

How can I restore the file, such that it will work again? Btw. How can I clear the stored data without crashing the server?

Upvotes: 1

Views: 1021

Answers (1)

akkerman
akkerman

Reputation: 119

mosquitto uses an in memory database. when persistence is enabled the data is written to mosquitto.db periodically and on shutdown. on startup it is read again.

your file is empty, there is nothing to load. this might be the problem. if you just remove it and enable persistence mosquitto should create it again after restart.

if it is not there after restart you might have to wait the defaut 30min between saves. shorten that time in your config (autosave_interval) or send signal SIGUSR1 (kill -SIGUSR1 ‘mosquitto pid’)

Upvotes: 2

Related Questions