在mosquitto 多古中,描述了当将persistence设置为true时
当蚊子关闭时,这些数据将被写入磁盘,并按autosave_interval所定义的周期间隔写入磁盘。
由于周期性的“转储”,mosquitto.db文件将不断增加。如何自动清除旧数据(我不需要历史记录,只需要最新的值)
发布于 2020-07-23 07:58:58
你没有而且你的前提似乎是错的。
文件不应该继续增长,当代理刷新它在内存数据库中时,它取代了磁盘上的文件,它不只是附加到末尾。
如果文件正在增长,那么内存数据库中的文件也是如此,您在某个时候会遇到问题。
持久化存储包含三种东西。
cleanSession设置为false。- Inflight high QOS messages, these should normally be transient held only until it has been fully handled by the broker/subscribers- Queued messages for offline clients with persistent sessions and high QOS subscriptions. If you have clients that are currently offline then this will grow dependent on message size/rate until the client comes back online (see point 2 if you don't think you should have clients offline for a long time)如果需要的话,您也可以使用蚊子选项persistent_client_expiration duration在给定的时间之后删除持久会话。
https://stackoverflow.com/questions/63048804
复制相似问题