9

I'm using Mosquitto Project (http://mosquitto.org), this is my mosquitto.conf

persistence_file mosquitto.db

persistence_location C:/var/lib/mosquitto/

After running, I have got mosquitto.db, but I can't open it. I'm trying open with Microsoft Excel, sqlitebrowser_200_b1_win but it's not working. Please help me. Thanks in advance

2 Answers 2

14

I just answered this same question on the mosquitto answers tracker:

https://answers.launchpad.net/mosquitto/+question/217523

The mosquitto.db file holds internal persistence information on client subscriptions and retained messages. It isn't intended for use outside of mosquitto. There is no guarantee that it is up to date information.

Having said that, if you are interested in looking at the file then the source file to look at is src/persist.c. There is also a program to print the file contents in a more readable manner - you should compile src/db_dump/db_dump.c.

mosquitto.db is an internal file and has nothing to do with sql.

3
  • From Where I can get src/db_dump/db_dump.c. file?
    – kavie
    Commented Jul 6, 2018 at 8:35
  • @kavie in the source code bundle for mosquitto perhaps? github.com/eclipse/mosquitto/tree/master/src/db_dump
    – hardillb
    Commented Jul 6, 2018 at 12:35
  • yeah .it is there,I'm from Java background.I don't know how to use this.Can u help me for this?
    – kavie
    Commented Jul 8, 2018 at 14:55
9

To read mosquitto.db file do these steps

git clone https://github.com/eclipse/mosquitto
cd mosquitto/apps/db_dump
make
sudo ./mosquitto_db_dump /var/lib/mosquitto/mosquitto.db

You'll then get output like

DB_CHUNK_SUB:
        Length: 54
        Client ID: <Your Client ID>
        Topic: <topic>
        QoS: 0
        Subscription ID: 0
        Options: 0x00

Or

DB_CHUNK_MSG_STORE:
        Length: 285
        Store ID: 28935676
        Source Port: 1883
        Source MID: 4027
        Topic: <topic>
        QoS: 1
        Retain: 0
        Payload Length: 190
        Expiry Time: 0
        Payload: <Payload>
1
  • 1
    hi, is it possible to get the definition of all those categories DB_CHUNK_MSG_STORE, DB_CHUNK_SUB, what does it means we coudnt find any documents related to that Commented Jan 20, 2023 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.