When simulating the subscribe/pusher a lot of messages with qos 2, I found that data directory are increased steadily and never decrease the size although stoping the hivemq.
It will cause the issue over disk memory. Could you guys help to decrease the size? for ex: after pushed message successfully…
Great that you are interested in MQTT and HiveMQ, welcome to the community!
The data/persistence directory stores persistent data of the broker, such as
Retained messages
Subscriptions of persistent-session clients
Queued messages of persistent-session clients
The current state of each individual message transmission that is not yet completed
If you want to keep all persistence data, you must keep the data directory as it is. If you are Ok to lose all your persistent data, you can delete the data directory after you stop the broker. Once the broker is started again, it will create a new data directory.
In your first message, you indicated that the data directory is increasing, when you simulated (published?) a lot of messages with QoS 2. I am wondering, did you also see the data directory increasing with QoS 1 and QoS 0 messages, or this is only with QoS 2?
1 client subscribe to topic be call topic1.
1 client push 10 messages to topic1 successfully with Qos2. Then client received all 10 messages.
I double check these directories in persistence and found that the size of that are always increase. I keep clients and brokers alive and 1 hour later, I double check size again, but size is NOT decrease.
I search some message’s infomation and found that it still keep in payload persistence dir. or something like that
I did not understand, if you have tested this with QoS 0 and QoS 1 or not, could you please confirm that?
To get a better overview of the activity of your client, try to check the event.log file at $HIVEMQ_HOME/log/event.log. You can filter the log for the Client ID of the1 client that you are testing with.
For example, when the client connects, the event.log will contain the line like:
The line contains the Client ID, IP, the Clean Start flag, and the Session Expiry interval.
When a client disconnects, the event.log will contain the line like this:
du -s data/persistence/publish_payload_store
39296 data/persistence/publish_payload_store
➜ hivemq du -s data/persistence/client_queue/
11224 data/persistence/client_queue/
Stop the subscriber and stop the publisher
2023-01-11 11:56:55,092 - Client ID: Srv_f87b4f55-c3d1-4efd-ae10-bca53e654050, IP: 192.168.31.93 disconnected ungracefully.
2023-01-11 11:57:45,559 - Client ID: Web_58408 session has expired at 2023-01-11 04:56:54. All persistent data for this client has been removed.
2023-01-11 12:15:31,035 - Client ID: Srv_f87b4f55-c3d1-4efd-ae10-bca53e654050 session has expired at 2023-01-11 04:56:55. All persistent data for this client has been removed.
Check directory size again ( has waiting time)
The size of directories are not decrease
hivemq du -s data/persistence/publish_payload_store
39936 data/persistence/publish_payload_store
➜ hivemq du -s data/persistence/client_queue/
11224 data/persistence/client_queue/