Configuration lines start with a variable name. The variable
value is separated from the name by a single space.
- acl_file file path
-
Set the path to an access control list file. If
defined, the contents of the file are used to control
client access to topics on the broker.
If this parameter is defined then only the topics
listed will have access. Topic access is added with lines
of the format:
topic [read|write] <topic>
The access type is controlled using "read" or
"write". This parameter is optional - if not given then the
access is read/write. <topic> can contain the + or #
wildcards as in subscriptions.
The first set of topics are applied to anonymous
clients, assuming allow_anonymous is true. User specific
topic ACLs are added after a user line as follows:
user <username>
The username referred to here is the same as in
password_file. It is not the clientid.
It is also possible to define ACLs based on pattern
substitution within the topic. The form is the same as for
the topic keyword, but using pattern as the keyword.
pattern [read|write] <topic>
The patterns available for substition are:
-
- •
-
%c to match the client id of the client
- •
-
%u to match the username of the client
The substitution pattern must be the only text for
that level of hierarchy. Pattern ACLs apply to all users
even if the "user" keyword has previously been
given.
Example:
pattern write sensor/%u/data
Reloaded on reload signal. The currently loaded ACLs will be
freed and reloaded. Existing subscriptions will be affected
after the reload.
- allow_anonymous [ true | false ]
-
Boolean value that determines whether clients that
connect without providing a username are allowed to
connect. If set to false then a password file should be
created (see the password_file option) to control
authenticated client access. Defaults to true.
Reloaded on reload signal.
- 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).
Reloaded on reload signal.
- bind_address address
-
Listen for incoming network connections on the
specified IP address/hostname only. This is useful to
restrict access to certain network interfaces. To restrict
access to mosquitto to the local host only, use "bind_address
localhost". This only applies to the default listener. Use
the listener variable to control other listeners.
Not reloaded on reload signal.
- clientid_prefixes prefix
-
If defined, only clients that have a clientid with a
prefix that matches clientid_prefixes will be allowed to
connect to the broker. For example, setting "secure-" here
would mean a client "secure-client" could connect but
another with clientid "mqtt" couldn't. By default, all
client ids are valid.
Reloaded on reload signal. Note that currently connected
clients will be unaffected by any changes.
- listener port
-
Listen for incoming network connection on the
specified port. A second optional argument allows the
listener to be bound to a specific ip address/hostname. If
this variable is used and neither bind_address nor port are
used then the default listener will not be started. This
option may be specified multiple times. See also the
mount_point option.
Not reloaded on reload signal.
- log_dest destinations
-
Send log messages to a particular destination.
Possible destinations are: stdout stderr syslog topic.
stdout and stderr log to the console on the named output.
syslog uses the userspace syslog facility which usually
ends up in /var/log/messages or similar and topic logs to the
broker topic '$SYS/broker/log/<severity>', where severity
is one of D, E, W, N, I which are debug, error, warning,
notice and information. Use "log_dest none" if you wish to
disable logging. Defaults to stderr. This option
may be specified multiple times.
Reloaded on reload signal.
- log_timestamp [ true | false ]
-
Boolean value, if set to true a timestamp value will
be added to each log entry. The default is true.
Reloaded on reload signal.
- log_type types
-
Choose types of messages to log. Possible types are:
debug, error, warning, notice, information, none. Defaults
to error, warning, notice and information. This option may
be specified multiple times. Note that the debug type (used
for decoding incoming network packets) is never logged in
syslog or topics.
Reloaded on reload signal.
- max_connections count
-
Limit the total number of clients connected for the
current listener. Set to -1 to have
"unlimited" connections. Note that other limits may be
imposed that are outside the control of mosquitto. See
e.g.
limits.conf(5).
Not reloaded on reload signal.
- max_inflight_messages count
-
The maximum number of QoS 1 or 2 messages that can be
in the process of being transmitted simultaneously. This
includes messages currently going through handshakes and
messages that are being retried. Defaults to 20. Set to 0
for no maximum. If set to 1, this will guarantee in-order
delivery of messages.
Reloaded on reload signal.
- max_queued_messages count
-
The maximum number of QoS 1 or 2 messages to hold in
the queue above those messages that are currently in
flight. Defaults to 100. Set to 0 for no maximum (not
recommended).
Reloaded on reload signal.
- mount_point topic prefix
-
This option is used with the listener option to
isolate groups of clients. When a client connects to a
listener which uses this option, the string argument is
attached to the start of all topics for this client. This
prefix is removed when any messages are sent to the client.
This means a client connected to a listener with mount
point example can only see messages that
are published in the topic hierarchy
example and above.
Not reloaded on reload signal.
- password_file file path
-
Set the path to a password file. If defined, the
contents of the file are used to control client access to
the broker. Each line should be in the format
"username:password", where the colon and password are
optional but recommended. If allow_anonymous is set to
false, only users defined in this file will be able to
connect. Setting allow_anonymous to true when password_file
is defined is valid and could be used with acl_file to have
e.g. read only guest/anonymous accounts and defined users
that can publish.
Reloaded on reload signal. The currently loaded username and
password data will be freed and reloaded. Clients that are
already connected will not be affected.
- persistence [ true | false ]
-
Can be true or false. If true, connection,
subscription and message data will be written to the disk
in mosquitto.db at the location dictated by
persistence_location. When mosquitto is restarted, it will
reload the information stored in mosquitto.db. The data
will be written to disk when mosquitto closes and also at
periodic intervals as defined by autosave_interval. Writing
of the persistence database may also be forced by sending
mosquitto the SIGUSR1 signal. If false, the data will be
stored in memory only. Defaults to false.
Reloaded on reload signal.
- persistence_file file name
-
The filename to use for the persistent database. Defaults to mosquitto.db.
Reloaded on reload signal.
- persistence_location path
-
The path where the persistence database should be
stored. Must end in a trailing slash. If not given, then
the current directory is used.
Reloaded on reload signal.
- pid_file file path
-
Write a pid file to the file specified. If not given
(the default), no pid file will be written. If the pid file
cannot be written, mosquitto will exit. This option only
has an effect is mosquitto is run in daemon mode.
If mosquitto is being automatically started by an
init script it will usually be required to write a pid
file. This should then be configured as
/var/run/mosquitto.pid
Not reloaded on reload signal.
- port port number
-
Set the network port for the default listener to
listen on. Defaults to 1883.
Not reloaded on reload signal.
- retained_persistence [ true | false ]
-
This is a synonym of the persistence
option.
Reloaded on reload signal.
- retry_interval seconds
-
The integer number of seconds after a QoS=1 or QoS=2
message has been sent that mosquitto will wait before
retrying when no response is received. If unset, defaults
to 20 seconds.
Reloaded on reload signal.
- store_clean_interval seconds
-
The integer number of seconds between the internal
message store being cleaned of messages that are no longer
referenced. Lower values will result in lower memory usage
but more processor time, higher values will have the
opposite effect. Setting a value of 0 means the
unreferenced messages will be disposed of as quickly as
possible. Defaults to 10 seconds.
Reloaded on reload signal.
- sys_interval seconds
-
The integer number of seconds between updates of the
$SYS subscription hierarchy, which provides status
information about the broker. If unset, defaults to 10
seconds.
Reloaded on reload signal.
- user username
-
When run as root, change to this user and its primary
group on startup. If mosquitto is unable to change to this
user and group, it will exit with an error. The user
specified must have read/write access to the persistence
database if it is to be written. If run as a non-root user,
this setting has no effect. Defaults to mosquitto.
This setting has no effect on Windows and so you
should run mosquitto as the user you wish it to run
as.
Not reloaded on reload signal.
Bridges cannot currently be reloaded on reload signal.