mosquitto 參數配置


mosquitto 參數配置


1.retry_interval 


當QoS為1或2的消息已經被發送后,mosquitto在一段時間內仍未接收到客戶端的反饋消息,將重新發送消息。 默認為20秒


2.sys_interval 


每隔一段時間將更新$SYS層級話題的狀態,其中包含着proker的狀態信息。 默認為10秒


3.store_clean_interval


表示間隔多長時間將不再被使用的消息銷毀掉。該值越小,使用的內存就會越小但會需要更多的處理時間。 如果設置為0,表示不被
使用的消息將會及時銷毀。 默認為10秒


4. pid_file  默認為/var/run/mosquitto.pid


5.user   設置mosquitto啟動用戶


6.max_inflight_messages 


表示允許多大數量的QoS為1或2消息被同時進行傳輸處理。這些消息包括正在進行握手的消息和進行重新發送的消息。默認為20個,
如果設置為0,表示不設限制;如果為1,則會確保消息被順序處理。


7.max_queued_messages


表示允許多大數量的QoS為1或2消息在隊列中進行排隊。 默認為100個


8.max_connections


設置最大的連接數  -1表示不限制


9.autosave_interval


表示當開啟持久化設置時,間隔多少時間mosquitto會把內存中的消息保存到磁盤中。默認為30分鍾,當設置為0時,只有mosquitto
關閉的時候才會寫的磁盤中。


10.persistence


設置為true時,所有的連接,訂閱和消息數據都會被保存到磁盤的mosquitto.db文件中。當mosquitto重啟的時候,它會從mosquitto.db文件中
重新加載數據。


11.persistence_location  默認為/var/lib/mosquitto/


12.log_dest  


設置日志的輸出目的地 可以是:stdout stderr syslog topic   如果輸出到某個文件的話可以這樣設置log_dest file /var/log/mosquitto.log  要賦予對mosquitto.log文件的讀寫權限。


13.log_type  日志類型:debug, error, warning, notice, information, subscribe, unsubscribe, websockets, none, all


14.log_timestamp   是否記錄日志時間


15.clientid_prefixes


設置只有clientId以某個前綴開始的客戶端才允許連接到mosquitto broker.


16.allow_duplicate_messages


如果一個客戶端訂閱了多個topic時,設置是否允許接收重復的消息。比如訂閱了foo/# 和 foo/+/baz。


17.autosave_on_changes 


If true, mosquitto will count the number of subscription changes, retained messages received and queued messages and if the total exceeds autosave_interval then the in-memory database will be saved to disk. If false, mosquitto will save the in-memory database to disk by treating autosave_interval as a time in seconds


18.persistent_client_expiration


持久訂閱的過期設置。 對於將clean session設置為false的持久訂閱客戶端,如果在一定的時間段里面沒有重新連接mosquitto將會被移除。
這並不是一個標准的配置項,因為對於MQTT協議來說所有的持久訂閱應該是永遠有效的。
如: persistent_client_expiration 2m  persistent_client_expiration 14d persistent_client_expiration 1y 
h:小時  d:天  m:月  y:年


19.queue_qos0_messages 是否將QoS為0的消息計算到max_queued_messages參數中


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM