Mosquitto

Introduction

Mosquitto is an open-source messaging broker that implements MQTT on data coming from IoT devices, by implementing the MQTT protocol. It is lightweight and is suitable for use on all devices from low power single board computers to high performance compute servers.

--(Eclipse Foundation 2022)

Install Mosquitto with Docker

To install mosquitto using a docker compose file to setup a container, define a docker-compose file like below.

 version: "3"
services:
broker:
image: eclipse-mosquitto
volumes:
- "./mosquitto:/mosquitto"
- "./mosquitto/config:/mosquitto/config"
- "./mosquitto/data:/mosquitto/data"
- "./mosquitto/log:/mosquitto/log"
ports:
- "1883:1883"
- "9001:9001"

Some notes about the configurations:

Configure Mosquitto

Example Configuration

Here's an example configuration that can be used in the example from before. There's other sections to describe some of the configuration keys. The format is just a simple non-spaced key name, followed by a space and a configuration value.

allow_anonymous true
listener 1883
persistence false
persistence_location /mosquitto/data
log_dest file /mosquitto/log/mosquitto.log

allow_anonymous

listener

persistence

persistence_location

log_dest

References

Web Links

Note Links