how to read MQTT mosquitto server persisted DB file

僤鯓⒐⒋嵵緔 提交于 2019-12-12 02:43:12

问题


I am using mosquitto server for MQTT protocol. Using persistence setting in a configuration file with -c option, I am able to save the data. However the file generated is binary one. How would one be able to read that file?

Is there any specific tool available for that?

Appreciate your views.

Thanks! Amit


回答1:


Why do you want to read it?

The data is only kept there while messages (QOS1 or QOS2) are in flight to ensure they are not lost in transit while waiting for a response from the subscribed client.

Data may also be kept for clients that are disconnected but have persistent subscriptions (cleanSession=false) until that client reconnects.

If you are looking to persist all messages for later consumption you will have to write a client to subscribe and store this data in a DB of your choosing. One possible option to do this quickly and simply is Node-RED, but there are others and some brokers even have plugins for this e.g. HiveMQ.

If you really want to read it then you will probably have to write your own tool to do this based on the Mosquitto src code



来源:https://stackoverflow.com/questions/31943759/how-to-read-mqtt-mosquitto-server-persisted-db-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!