Skip to main content
Version: Mosquitto 2.5

Overview

Name

Mosquitto - an MQTT broker

Synopsis

mosquitto [-c config file][ -d | --daemon ] [-p port number][-v]

Description​

Mosquitto is a broker for the MQTT protocol version 5.0/3.1.1/3.1.

Options

  • -c, --config-file

Load configuration from a file. If not given, then the broker will listen on port 1883 bound to the loopback interface, and the default values as described in mosquitto.conf(5) are used.

  • -p

See the -p option for a description of changes in behaviour from 1.6.x to 2.0.

In version 1.6.x and earlier, the listener defined by -p (or the default port of 1883) would be bound to all interfaces and so be accessible from any network. It could also be used in combination with -c.

From version 2.0 onwards, the listeners defined with -p are bound to the loopback interface only, and so can only be connected to from the local machine. If both -p is used and a listener is defined in a configuration file, then the -p options are IGNORED.

  • -d, --daemon

Run mosquitto in the background as a daemon. All other behaviour remains the same.

  • -p, --port

Listen on the port specified. May be specified up to 10 times to open multiple sockets listening on different ports.

  • -v, --verbose

Use verbose logging. This is equivalent to setting log_type to all in the configuration file. This overrides and logging options given in the configuration file.

Configuration

The broker can be configured using a configuration file as described in mosquitto.conf(5) and this is the main point of information for mosquitto. The files required for SSL/TLS support are described in mosquitto-tls(7).

Files

  • /etc/mosquitto/mosquitto.conf

Configuration file. See Mosquitto Configuration.

  • /var/lib/mosquitto/mosquitto.db

Persistent message data storage location if persist enabled.

  • autosave_interval seconds

The number of seconds that mosquitto will wait between each time it saves the in-memory database to disk. If set to 0, the in-memory database will only be saved when mosquitto exits or when receiving the SIGUSR1 signal. Note that this setting only has an effect if persistence is enabled. Defaults to 1800 seconds (30 minutes).

This option applies globally.

Reloaded on reload signal.

  • /etc/hosts.allow, /etc/hosts.deny

Host access control via tcp-wrappers as described in hosts_access(5).

Platform limitations

Some versions of Windows have limitations on the number of concurrent connections due to the Windows API being used. In modern versions of Windows, e.g. Windows 10 or Windows Server 2019, this is approximately 8192 connections. In earlier versions of Windows, this limit is 2048 connections.