1 mosquitto配置文件/etc/mosquitto/mosquitto.conf配置参数详细说明2
3 2018年09月07日 09:42:30 jacklin_001 阅读数:412
4 # =================================================================
5 # General configuration6 # =================================================================
7
8 # 客户端心跳的间隔时间9 #retry_interval 20
10
11 # 系统状态的刷新时间12 #sys_interval 10
13
14 # 系统资源的回收时间,0表示尽快处理15 #store_clean_interval 10
16
17 # 服务进程的PID18 #pid_file /var/run/mosquitto.pid19
20 # 服务进程的系统用户21 #user mosquitto22
23 # 客户端心跳消息的最大并发数24 #max_inflight_messages 10
25
26 # 客户端心跳消息缓存队列27 #max_queued_messages 100
28
29 # 用于设置客户端长连接的过期时间,默认永不过期30 #persistent_client_expiration31
32 # =================================================================
33 # Default listener34 # =================================================================
35
36 # 服务绑定的IP地址37 #bind_address38
39 # 服务绑定的端口号40 #port 1883
41
42 # 允许的最大连接数,-1表示没有限制43 #max_connections -1
44
45 # cafile:CA证书文件46 # capath:CA证书目录47 # certfile:PEM证书文件48 # keyfile:PEM密钥文件49 #cafile50 #capath51 #certfile52 #keyfile53
54 # 必须提供证书以保证数据安全性55 #require_certificate false
56
57 # 若require_certificate值为true,use_identity_as_username也必须为true58 #use_identity_as_username false
59
60 # 启用PSK(Pre-shared-key)支持61 #psk_hint62
63 # SSL/TSL加密算法,可以使用“openssl ciphers”命令获取64 # as the output of that command.65 #ciphers66
67 # =================================================================
68 # Persistence69 # =================================================================
70
71 # 消息自动保存的间隔时间72 #autosave_interval 1800
73
74 # 消息自动保存功能的开关75 #autosave_on_changes false
76
77 # 持久化功能的开关78 persistence true
79
80 # 持久化DB文件81 #persistence_file mosquitto.db82
83 # 持久化DB文件目录84 #persistence_location /var/lib/mosquitto/
85
86 # =================================================================
87 # Logging88 # =================================================================
89
90 # 4种日志模式:stdout、stderr、syslog、topic91 # none 则表示不记日志,此配置可以提升些许性能92 log_dest none93
94 # 选择日志的级别(可设置多项)95 #log_type error96 #log_type warning97 #log_type notice98 #log_type information99
100 # 是否记录客户端连接信息101 #connection_messages true
102
103 # 是否记录日志时间104 #log_timestamp true
105
106 # =================================================================
107 # Security108 # =================================================================
109
110 # 客户端ID的前缀限制,可用于保证安全性111 #clientid_prefixes112
113 # 允许匿名用户114 #allow_anonymous true
115
116 # 用户/密码文件,默认格式:username:password117 #password_file118
119 # PSK格式密码文件,默认格式:identity:key120 #psk_file121
122 # pattern write sensor/%u/data123 # ACL权限配置,常用语法如下:124 # 用户限制:user
125 # 话题限制:topic [read|write]
126 # 正则限制:pattern write sensor/%u/data127 #acl_file128
129 # =================================================================
130 # Bridges131 # =================================================================
132
133 # 允许服务之间使用“桥接”模式(可用于分布式部署)134 #connection
135 #address [:]136 #topic [[[out | in | both] qos-level] local-prefix remote-prefix]137
138 # 设置桥接的客户端ID139 #clientid140
141 # 桥接断开时,是否清除远程服务器中的消息142 #cleansession false
143
144 # 是否发布桥接的状态信息145 #notifications true
146
147 # 设置桥接模式下,消息将会发布到的话题地址148 # $SYS/broker/connection//state149 #notification_topic150
151 # 设置桥接的keepalive数值152 #keepalive_interval 60
153
154 # 桥接模式,目前有三种:automatic、lazy、once155 #start_type automatic156
157 # 桥接模式automatic的超时时间158 #restart_timeout 30
159
160 # 桥接模式lazy的超时时间161 #idle_timeout 60
162
163 # 桥接客户端的用户名164 #username165
166 # 桥接客户端的密码167 #password168
169 # bridge_cafile:桥接客户端的CA证书文件170 # bridge_capath:桥接客户端的CA证书目录171 # bridge_certfile:桥接客户端的PEM证书文件172 # bridge_keyfile:桥接客户端的PEM密钥文件173 #bridge_cafile174 #bridge_capath175 #bridge_certfile176 #bridge_keyfile177
178 # 自己的配置可以放到以下目录中179 include_dir /etc/mosquitto/conf.d