How to configure Vernemq Broker to save messages to persistence storage

Can you let please let me know how to configure Vernemq Broker to save VerneMQ broker to persistence storage such as Google LevelDB or MySQL or MongoDB

Thank you for your help and Support.

2 Likes

When I start the Docker container

docker run -p 1883:1883 -p 8888:8888 -e “DOCKER_VERNEMQ_LISTENER__TCP__ALLOWED_PROTOCOL_VERSIONS=3,4,5” -e “DOCKER_VERNEMQ_ACCEPT_EULA=yes” -e “DOCKER_VERNEMQ_ALLOW_ANONYMOUS=on” -e “SHARED_SUBSCRIPTION_POLICY=prefer_local” -e “DOCKER_VERNEMQ_VMQ_WEBHOOKS__POOL_timeout=6000” -e “DOCKER_VERNEMQ_VMQ_WEBHOOKS.pool_timeout=60000” -e “DOCKER_VERNEMQ_LEVELDB__MAXIMUM_MEMORY__PERCENT=40” -e “DOCKER_VERNEMQ_LISTENER__TCP__DEFAULT__MAX_CONNECTIONS=200000” -e DOCKER_VERNEMQ_LOG__CONSOLE=both -e “DOCKER_VERNEMQ_LOG__CONSOLE__LEVEL=debug” -e “LOG_CONSOLE_FILE=/opt/scats/log/vernemq.log” -e “LOG_ERROR_FILE=/opt/scats/log/vernemq_error.log” -d vernemq/vernemq &

in the /etc/vernemq/vernemq.config it contains is still set eveldb.maximum_memory.percent = 70 instrad of eveldb.maximum_memory.percent = 70. Please see the output below

leveldb.maximum_memory.percent = 70

########## Start ##########
vmq_webhooks.pool_timeout=60000
log.console.level=debug
accept_eula=yes
leveldb.maximum_memory.percent=40
listener.tcp.allowed_protocol_versions=3,4,5
listener.tcp.default.max_connections=200000
log.console=both
vmq_webhooks.pool_timeout=6000
allow_anonymous=on
erlang.distribution.port_range.minimum = 9100
erlang.distribution.port_range.maximum = 9109
listener.tcp.default = 172.17.0.2:1883
listener.ws.default = 172.17.0.2:8080
listener.vmq.clustering = 172.17.0.2:44053
listener.http.metrics = 172.17.0.2:8888

1 Like

The values you introduce as Docker env variables get written to the vernemq.conf file in the end section, after that #### START #### line.

Those values are not overwritten in place. As usual in config files, the last occurrence counts.
And it seems there’s a line with what you want?
leveldb.maximum_memory.percent=40

2 Likes

LevelDB ensures all of the internal persistence guarantees.

If you’re thinking about a message archive, this should be an external component facilitated by a plugin or connecting over MQTT transport (Apache NiFi etc.).

2 Likes

Thank you for your answer @afa.

3 Likes