Mosquitto MQTT Broker

install mosquitto iconMosquitto is a lightweight open source message broker that Implements MQTT versions 3.1 and 3.1.1.

It is written in C by Roger Light, and is available as a free download for Windows and Linux and is an Eclipse project.

The main website is here.

Installing The Broker

To use it you will first need to install it.

Starting and Stopping The Broker

Depending on the install it will probably be started automatically on system startup.

On Windows you can stop the service if it is running by using the control panel>admin>services.

You can also the net command:

net stop mosquitto

On Linux use:

sudo service mosquitto stop

Starting from command line is the best option when testing and to do that use:


mosquitto -v   #start in verbose mode


sudo mosquitto -v #start in verbose mode

To see other start options use:

mosquitto -h

By default the broker will start listening on port 1883. You can change that by editing the configuration file-mosquitto.conf See Quick Guide to The Mosquitto.conf File With Examples

Alternatively you can use a command line switch to specify the port e.g.

mosquitto -p 1884

You can run Multiple brokers on the same machine by starting them on different ports See this video- on running multiple brokers.

Mosquitto Client Scripts

The mosquitto install includes the client scripts.

There is a simple subscriber client


and a publisher client



They are useful for some quick tests. See Using The Mosquitto_pub and Mosquitto_sub Client Tools- Examples

Other Tutorials

Please rate? And use Comments to let me know more
[Total: 0    Average: 0/5]

Leave a Reply

Your email address will not be published. Required fields are marked *