15

As of now the EMQ (Erlang MQTT Broker) does not seem to persist QoS 1/2 messages to disk: How does EMQ persist QoS 1/2 messages?

So in case of an unexpected server reboot, memory limits, or other event messages might be lost despite QoS 1/2 level messages must be delivered at least or exactly once.

Are there MQTT brokers that persist QoS 1/2 messages to disk thus ensuring delivery?

1

3 Answers 3

10

I think Mosquitto saves the in-memory messages to disk.

persistence [ true | false ] If true, connection, subscription and message data will be written to the disk in mosquitto.db at the location dictated by persistence_location. When mosquitto is restarted, it will reload the information stored in mosquitto.db. The data will be written to disk when mosquitto closes and also at periodic intervals as defined by autosave_interval. Writing of the persistence database may also be forced by sending mosquitto the SIGUSR1 signal. If false, the data will be stored in memory only. Defaults to false.

0
8

VerneMQ is an example of an MQTT broker that guarantees delivery of accepted QoS1/2 messages as they are written to disk (using LevelDB). VerneMQ is, in a way, similar to EMQ in that it is also open-source and supports clustering (although using a different technology). Full disclosure, I'm a VerneMQ engineer.

5
  • Side question: Did you guys offer public VerneMQ broker for testing and evaluation?
    – Ross
    Commented Jan 18, 2017 at 8:54
  • 1
    Hi @Ross, we have a public instance running on public.vernemq.com:1883, but you'd not be able to do load testing there as it's running on a small virtual machine - so don't expect it to be very performant. It also has restrictions on the number of concurrent connections originating from a single IP. If you'd like you could contact us and we'd be happy to see if we can support your use-case. You can write us at info at vernemq dot com or fill out the contact form here: vernemq.com/services.html Commented Jan 18, 2017 at 9:03
  • 1
    Thanks, I do not need to do load testing, just to check that I can connect to different brokers and see if there are any compatibility issues.
    – Ross
    Commented Jan 18, 2017 at 9:07
  • 1
    That reminds, me, the public version is relatively old - I'll see if I can't get it upgraded to the latest release today. Commented Jan 18, 2017 at 9:11
  • Due to some reason, I am not able to enable the persistent storage. We're using K8s with vernemq. Are there any articles on how to use persistent storage with vernemq? Maybe I am missing something small.
    – Logan
    Commented Oct 4, 2022 at 10:55
6

HiveMQ seems to provide various options to persist session data, including QoS 1/2 messages.

The persistence options are listed here:

  • File persistence
  • In-Memory persistence

By default, HiveMQ will use the file persistence, which saves all the data to the disk so it can be retrieved at any time.

In order to guarantee consistency of data between broker restarts, HiveMQ uses disk persistence by default. That means that even if the broker stops or crashes, all data will be preserved and after a restart the broker can continue its operation as if nothing happened.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.