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?

Ghanima
  • 2,539
  • 1
  • 19
  • 46

3 Answers3

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.

Ross
  • 200
  • 6
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.

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.

Aurora0001
  • 18,520
  • 13
  • 55
  • 169