Delete all retained messages from server?

Is there an easy way of deleting all retained messages from the server ?
Can I just delete all files/folders under: /var/lib/vernemq/msgstore ?
“vmq-admin retain delete”, just deletes one at a time. I messed up by a few thousand messages retained…

Thanks! :smiley:

There’s no direct way of doing this currently.
You can look at the user-proposed workarounds in the Github issue here: Proposal: ability to remove retained messages · Issue #1127 · vernemq/vernemq · GitHub

You can also experiment with mosquitto_sub --remove-retained flag although practically this means that the user needs to have very broad subscribe and publish permissions.

I hope this helps somewhat :slight_smile:
Btw, note that retained messages are part of metadata, that is not part of the files under msgstore. You could delete everything under /var/lib/vernemq after a node stop and then reboot. But this will give you an entirely reset and fresh VerneMQ node. While this can be a solution for a single Verne server, it’s certainly not a viable approach in a clustered setup.

1 Like

Many thanks ! The folder cleanup worked perfectly.

Cool. :slight_smile: Just to make sure, it’s only a solution if you can “afford” to loose all broker state.

Exactly, and would be great to have the wildcard “*” in the vmq-admin command…

1 Like