Silo is an open source tool to archive MQTT messages. It supports MySQL, Postgres and Mongodb. Silo is compatible with emqtt and verneMQ.
To install Silo follow the instructions
You should install oracle java 8 to run Silo and maven to compile it
chmod +x ./install
./install
to configure Silo, find silo.yaml in /opt/silo