eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.93k stars 2.37k forks source link

Win10 - database not saved #1883

Open smarty70 opened 3 years ago

smarty70 commented 3 years ago

I start the broker (Version 1.6.8) under Windows 10 as follows and not as a service:

start "mosquitto.exe" /MIN "mosquitto.exe" -c mosquitto.conf -v

The configuration is:

autosave_interval 0 persistence true persistence_file my_mosquitto.db

All publish messages were sent as retained message and QoS=1. But when i close the broker no my_mosquitto.db file is written.

When I change the configuration to:

autosave_interval 5 persistence true persistence_file my_mosquitto.db

Every 5 seconds the my_mosquitto.db file is written.

Why does the first configuration not work? What do I do wrong?

Thanks

ralight commented 3 years ago

I think the most likely explanation here is that when you close the broker it is completely terminating the broker rather than signalling that it should close and letting the broker close and write the persistence file. I'll see if I can reproduce it.

ralight commented 3 years ago

As this is issue/pull request number 1883, which is the MQTT port number, here is a special badge for you :) 1883-badge

smarty70 commented 3 years ago

I think the most likely explanation here is that when you close the broker it is completely terminating the broker rather than signalling that it should close and letting the broker close and write the persistence file. I'll see if I can reproduce it.

that's my guess too, how can i terminate the broker right? at the moment I close the broker with taskkill:

taskkill /f /im mosquitto.exe

or when I'm testing, with close button from the cmd-window

I only need the database when the broker breaks down or windows is rebooted and the broker starts again