This article will outline installing an instance of mosquitto for use as an MQTT broker.
An MQTT broker serves as a central hub or intermediary in an MQTT network, facilitating communication between various clients. This means that a dedicated device needs to exist to host the broker, and that an MQTT client can not directly speak to another MQTT client.
Upon installing mosquitto (available from the link above), we need to modify the configuration file included. This article will only provide basic settings, which are enough to get the broker started, and do not go into advanced configuration such as users and SSL security.
By default, mosquitto will install to C:\Program Files\mosquitto. In this directory, open the file mosquitto.conf as administrator in Notepad or other compatible text editor.
Create some space at the top of the document and enter in the following two lines
Save this and open a command prompt session via the following steps:
1. Click "Start"
2. Type "cmd" and press [[enter]]
3. Select the command prompt screen that appears and type "cd ../../ [[enter]]" to navigate to the root of the C:\ drive
4. Type "cd program files [[enter]]"
5. Type "cd mosquitto [[enter]]". To start the mosquitto MQTT broker, type "mosquitto.exe -v -c mosquitto.conf [[enter]]"
6. This has now successfully started the mosquitto MQTT broker
Alert: This MQTT broker does not include any level of security and should only be used for testing purposes. To configure properties such as username and password requirements or SSL, please see the mosquitto documentation found at https://mosquitto.org/man/mosquitto-conf-5.html
Files | ||
---|---|---|
DataImage8.png
13 KB
|