# Mosquitto MQTT Broker配置文件 # 基本配置 pid_file /var/run/mosquitto.pid persistence true persistence_location /mosquitto/data/ log_dest file /mosquitto/log/mosquitto.log log_type error log_type warning log_type notice log_type information # 网络配置 listener 1883 protocol mqtt # WebSocket支持 listener 9001 protocol websockets # 认证配置(可选,根据需要启用) # allow_anonymous false # password_file /mosquitto/config/passwd # 访问控制(可选,根据需要启用) # acl_file /mosquitto/config/acl # 连接配置 max_connections 1000 max_inflight_messages 20 max_queued_messages 100 message_size_limit 0 # 保持连接 keepalive_interval 60 retry_interval 20 sys_interval 10 # 日志配置 log_timestamp true log_timestamp_format %Y-%m-%dT%H:%M:%S # 安全配置(可选,根据需要启用) # cafile /mosquitto/certs/ca.crt # certfile /mosquitto/certs/server.crt # keyfile /mosquitto/certs/server.key # require_certificate false # use_identity_as_username false # 桥接配置(可选,根据需要启用) # connection bridge-01 # address remote.mqtt.broker:1883 # topic iot/# both 0 # 自动保存间隔 autosave_interval 1800 # 客户端过期时间 persistent_client_expiration 2h # 升级QoS upgrade_outgoing_qos false # 最大保留消息数 max_retained_messages 100 # 主题别名最大值 max_topic_alias 10