Mosquitto's configuration file is stored in /etc/mosquitto/mosquitto.conf
The specific configuration content of the configuration file is:
# ================================================================= # General configuration # ================================================================= # Client heartbeat interval #retry_interval 20 # System status refresh time #sys_interval 10 # Recycling time of system resources, 0 means processing as soon as possible #store_clean_interval 10 # PID of the service process #pid_file /var/run/mosquitto.pid # System user of the service process #user mosquitto # The maximum number of concurrent client heartbeat messages #max_inflight_messages 10 # Client heartbeat message cache queue #max_queued_messages 100 # Used to set the expiration time of the client's long connection, the default will never expire #persistent_client_expiration # ================================================================= # Default listener # ================================================================= # Service binding IP address #bind_address # Service binding port number #port 1883 # Maximum number of connections allowed, -1 means no limit #max_connections -1 # cafile: CA certificate file # capath: CA certificate directory # certfile: PEM certificate file # keyfile: PEM key file #cafile #capath #certfile #keyfile # A certificate must be provided to ensure data security #require_certificate false # If require_certificate is true, use_identity_as_username must also be true #use_identity_as_username false # Enable PSK (Pre-shared-key) support #psk_hint # SSL/TSL encryption algorithm, you can use the "openssl ciphers" command to obtain # as the output of that command. #ciphers # ================================================================= # Persistence # ================================================================= # Message auto-save interval #autosave_interval 1800 # The switch of the message auto-save function #autosave_on_changes false # Persistence function switch persistence true # Persist the DB file #persistence_file mosquitto.db # Persistent DB file directory #persistence_location /var/lib/mosquitto/ # ================================================================= # Logging # ================================================================= # 4 log modes: stdout, stderr, syslog, topic # none means no logging, this configuration can improve performance log_dest none # Select the level of the log (multiple items can be set) #log_type error #log_type warning #log_type notice #log_type information # Whether to record client connection information #connection_messages true # Whether to record log time #log_timestamp true # ================================================================= # Security # ================================================================= # Client ID prefix limit, which can be used to ensure security #clientid_prefixes # Allow anonymous users #allow_anonymous true # User/password file, default format: username:password #password_file # PSK format password file, default format: identity:key #psk_file # pattern write sensor/%u/data # ACL permission configuration, the common syntax is as follows: # User restrictions: user <username> # Topic limit: topic [read|write] <topic> # Regular limit: pattern write sensor/%u/data #acl_file # ================================================================= # Bridges # ================================================================= # Allow "bridge" mode between services (can be used for distributed deployments) #connection <name> #address <host>[:<port>] #topic <topic> [[[out | in | both] qos-level] local-prefix remote-prefix] # Set the bridge client ID #clientid # Whether to clear the message in the remote server when the bridge is disconnected #cleansession false # Whether to publish bridge status information #notifications true # Set the topic address to which the message will be published in bridge mode # $SYS/broker/connection/<clientid>/state #notification_topic # Set the bridge keepalive value #keepalive_interval 60 # Bridge mode, there are currently three: automatic, lazy, once #start_type automatic # Bridge mode automatic timeout #restart_timeout 30 # Bridge mode lazy timeout #idle_timeout 60 # bridge client username #username # Bridge client password #password # bridge_cafile: bridge client CA certificate file # bridge_capath: CA certificate directory of the bridge client # bridge_certfile: bridge client's PEM certificate file # bridge_keyfile: bridge client's PEM key file #bridge_cafile #bridge_capath #bridge_certfile #bridge_keyfile # Your own configuration can be placed in the following directory include_dir /etc/mosquitto/conf.d