mosquitto.conf 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Mosquitto MQTT Broker配置文件
  2. # 基本配置
  3. pid_file /var/run/mosquitto.pid
  4. persistence true
  5. persistence_location /mosquitto/data/
  6. log_dest file /mosquitto/log/mosquitto.log
  7. log_type error
  8. log_type warning
  9. log_type notice
  10. log_type information
  11. # 网络配置
  12. listener 1883
  13. protocol mqtt
  14. # WebSocket支持
  15. listener 9001
  16. protocol websockets
  17. # 认证配置(可选,根据需要启用)
  18. # allow_anonymous false
  19. # password_file /mosquitto/config/passwd
  20. # 访问控制(可选,根据需要启用)
  21. # acl_file /mosquitto/config/acl
  22. # 连接配置
  23. max_connections 1000
  24. max_inflight_messages 20
  25. max_queued_messages 100
  26. message_size_limit 0
  27. # 保持连接
  28. keepalive_interval 60
  29. retry_interval 20
  30. sys_interval 10
  31. # 日志配置
  32. log_timestamp true
  33. log_timestamp_format %Y-%m-%dT%H:%M:%S
  34. # 安全配置(可选,根据需要启用)
  35. # cafile /mosquitto/certs/ca.crt
  36. # certfile /mosquitto/certs/server.crt
  37. # keyfile /mosquitto/certs/server.key
  38. # require_certificate false
  39. # use_identity_as_username false
  40. # 桥接配置(可选,根据需要启用)
  41. # connection bridge-01
  42. # address remote.mqtt.broker:1883
  43. # topic iot/# both 0
  44. # 自动保存间隔
  45. autosave_interval 1800
  46. # 客户端过期时间
  47. persistent_client_expiration 2h
  48. # 升级QoS
  49. upgrade_outgoing_qos false
  50. # 最大保留消息数
  51. max_retained_messages 100
  52. # 主题别名最大值
  53. max_topic_alias 10