• 注册
当前位置:1313e > java >正文

java获取mosquitto连接数_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参数中

本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 162202241@qq.com 举报,一经查实,本站将立刻删除。

最新评论

欢迎您发表评论:

请登录之后再进行评论

登录