Installing Eclipse Mosquitto (Magic xpi 4.13)
This section describes how to install Eclipse Mosquitto. The Magic xpi Local Agent uses Mosquitto as the MQTT Broker for Communication Service.
It is recommended to use Eclipse Mosquitto on the Windows. If you are using any other MQTT Broker refer to its documentation for installation.
Before installing Eclipse Mosquitto, the following needs to be installed on the machine.
-
OpenSSL
OpenSSL can be downloaded from
http://slproweb.com/products/Win32OpenSSL.html
-
Microsoft Visual C++ 2017 Redistributable (x64)
Microsoft Visual C++ 2017 Redistributable (x64) can be downloaded from
https://visualstudio.microsoft.com/downloads/
Eclipse Mosquitto can be downloaded from:
https://www.eclipse.org/downloads/download.php?file=/mosquitto/binary/win64/mosquitto-1.5.4-install-windows-x64.exe&mirror_id=1190
It will download the mosquitto-1.5.x-install-windows-x64.exe on your machine. After downloading, install Eclipse Mosquitto by opening the installation file
Eclipse Mosquitto provides two modes for running the application.
· Anonymous Mode
· Broker Authentication Mode
|
Local Agent supports both the modes. If the Mosquitto broker is installed behind an API gateway which has its own authentication, the anonymous mode is recommended, as it requires less configuration.
|
Anonymous Mode
The Anonymous mode requires two files
· Configuration file (e.g. mosquito_localagent.conf)
· Command file (e.g. broker.cmd)
The user will have to set the ports and log file names in the configuration file as required.
Broker Authentication Mode
When using the Broker Authentication Mode, add a password file to the Mosquitto folder and give a proper reference in the configuration file.
Enter the required User Name and Password in the following files:
· application.properties files for Agent Service and Agent Connector
· mgmt-console-api.properties for Management Console
· magic.ini for Magic xpi server
For example, with username as localagent, the following call should be performed in the Mosquitto folder to create the password file:
mosquitto_passwd -c mosquitto.pass.txt localagent
After running this command the user will be asked to enter the password. On entering the password, the utility will create mosquitto.pass.txt file that contains the encrypted password.
The following changes should then be made to the configuration file:
· Change the allow_anonymous parameter as given:
allow_anonymous false
· Add two more lines that define username and password file:
user localagent
password_file .\msp.txt
In the application.properties files, corresponding entries should match the broker username and password, for example:
mqtt.broker.username=localagent
mqtt.broker.password=12345qwerty
These values are default and are written by the installer of the Local Agent. Any other values require manual adjustment.
Go to the Mosquitto installation folder and run broker.cmd.