Where Does Mosquitto Store Config and Data?
Mosquitto's conf file, persistence DB path, and the signal that flushes it to disk.
Last updated
Mosquitto splits static config from runtime state. The conf file sets everything including whether persistence exists at all, while mosquitto.db holds subscriptions and retained messages when enabled.
Persistence defaults off with in memory only storage. Turning it on without a writable persistence_location just moves the failure later, so set both together.
Where Mosquitto stores this, by platform
/etc/mosquitto/mosquitto.conf
Config file. Persistence DB at /var/lib/mosquitto/mosquitto.db when persistence true with persistence_location set. Force a flush with SIGUSR1. Passwords in /etc/mosquitto/tmo.passwd style files.
Frequently asked questions
Why is there no mosquitto.db file?
Persistence defaults to false, meaning memory only. Enable it plus a writable persistence_location, then restart or signal to create the file.
How do I back up Mosquitto state?
Signal SIGUSR1 to flush, then copy mosquitto.db with the broker stopped. The conf file and password files back up separately as plain text.
Notice an outdated path? Let us know.