Bevywise MQTTRoute is a complete IoT Application Suite with an inbuilt MQTT Broker. It acts as a central MQTT server for MQTT messaging, that facilitate MQTT connections to collect data from edge devices / Internet of Things (IoT) devices, store them into any big data engines, and send data to the subscribing client.
MQTTRoute uses Message Queuing Telemetry Transport (MQTT) protocol as its standard messaging protocol / communication protocol. MQTT works based on the publish-subscribe model. It provides you a fully extendable framework which helps you build powerful IoT / IIoT Application for any industrial use cases.
MQTTRoute is available both as a premium edition & FREE edition.
To know more on the premium edition, check our broker pricing page.
FREE edition, which is also known as a Developer edition, is a Fully FREE version making it available exclusively for Developers who are intended to build their own application using it.
This pack includes
Note : To connect more number of devices, upgrade to the premium version.
Here is everything a basic user can make use of from MQTT Broker installation, device connection to device management. Feel free to reach support for any queries.
MQTTRoute is available to download on Windows / Windows servers ( 64 bit), and Linux. The binaries are available as a zip archive for Linux and as a self-extracting exe for the Windows OS.
You can get your FREE MQTT Broker package from our Broker download page.
You can start MQTT Broker in multiple ways in windows :
Open terminal window. Go to the path where the downloaded MQTT Broker package is located & unzip the archive.
By default, broker starts on localhost IP address (127.0.0.1) and listens on port 1883.
Note : Check UI configuration part if broker failed due to socket error.
The other method through which you can start the message broker is by running it as a service. Running broker as a service helps you start broker automatically when the machine starts. You can avoid running it every time from the terminal or command prompt.
We have added this support for Windows & Linux.
To start MQTTRoute service,
To stop MQTTRoute service,
The bin folder (Bevywise/MQTTRoute/bin) contains RunAsService.sh file. Run this file to enable ‘set up the service file’ and ‘path’ (set as a symbolic link redirect to “/opt/Bevywise” folder).
Now, to start a service, use
To check status, use
To stop service, use
By default, the UI of the broker starts running in the port 8080.
You can access it by navigating to the browser and entering http://localhost:8080
Note : Check UI configuration part if you need to change the UI port
Once your installation & setup is completed, you can start connecting your devices, collect data & monitor it. If you don’t have one, you can download it from our python client libraries for different OS.
The below steps provides the procedure to connect MQTT Broker with above mentioned python client.
Make sure you have the python installed in your system.
Minimal requirement – Python 2.7
Unzip the downloaded python client library.
You can find the file named MQTTClient.py on accessing the client library.
Open the file in any editor and we have to do some configurations in the file to make it connect with our MQTT Broker
SERVER_NAME is the field where the IP address / DNS hostname of the broker should be given.
Note : The above instructions assumes that MQTT Broker is running in local machine and hence it is given as ‘localhost’. If MQTT Broker is running in any other server, IP address / hostname for the same should be provided.
SERVER_PORT – The port at which the MQTT broker is running. By default the broker starts at port 1883. If the broker uses TLS / SSL enabled authentication, then you can change the port to 8883.
Check Advanced Authentication (TLS / SSL) for more information.
The next step is to enter your Authentication credentials. You can get these credentials from MQTT Broker.
If you have disabled your Authentication field in MQTT Broker, you can leave this space unfilled & proceed.
Check Authentication Tab to know more.
The final step is to fill in the following parameters as required
MQClientID – This is the custom identifier field where you can provide specific ID to your client.
Publish_Topic_Name – The topic at which your client will send messages. You can fill in any custom topic names with multiple topic levels.
Click to know more on MQTT Topic.
MQTT supports 'Persistent session' feature, with the help of which broker can keep track of the client's information as well as the topics to which it is subscribed.
Publish_Message – You can decide what message / data needs to be published.
Subscribe_Topic_Name – The specific topic which your client will subscribe to.
In addition, you can change QoS, Retain or other parameters if needed.
Click to know more on QoS & Retain .
Now the configurations are set and the client is ready to get connected to the MQTT Broker.
To do so, open command prompt / terminal and go to the repository in which the MQTT Client library is located.
Then, start running the client by giving the following command.
python MQTTClient.py
Note : The name of my client file is MQTTClient.py. You can replace this with your file name.
Then the verification print will be displayed in terminal with all the configurations you have made in the client file. You can cross-check the details & press enter.
If the configurations are done right, client will get connected to the broker.
You can check the flow of messages both in the terminal and in the MQTT Broker Dashboard.
Check Dashboard tab to know more.
MQTT Broker connection with Bevywise IoT Simulator (MQTT Simulation tool)
MQTT authentication enables you to connect your devices more securely with authentication credentials. (See Connecting MQTT Clients / Devices).
This requires you to enable Authentication field in broker.conf file present in conf folder.
[AUTHENTICATION]
AUTHENTICATION_ENABLED = YES
# YES || NO
Save the file & restart the broker.
Now go to the UI of MQTT Broker. You will find the ‘Security’ tab displayed. You can get your Authentication credentials for secure device connection.
You can either use the default authentication parameters present in the security tab or you can create a new one.
To create Authentication parameters :
Click 'x' icon next to the added auth key and auth token to delete authentication credentials. The devices with the deleted credentials can no longer connect to the MQTT Broker.
Go to broker.conf present inside Conf folder.
By default, UI will be running in port 8080. You can change the port here based on your need.
UI port change may be required in scenario when port 8080 is occupied by
some
other application running on your system. If you are not aware of some other application
running,
you will get [Error 98] while running MQTT Broker.
Check the screenshot below for details.
In such a scenario, you can change the UI to some other port (make sure no other application is running).
Web login can be enabled or disabled based on the need. By default, MQTT Broker UI login will be enabled. You can disable the web login in broker.conf file.
By default, you can access the dashboard by providing username & password as admin & admin. If you would like to change the password, you can do it directly from the UI.
You can also change your username & password by doing some configurations inside conf folder.
WEB_USERNAME = admin
WEB_PASSWORD = admin
The well executed MQTT Broker UI enables you to monitor, visualize & manage your connected devices & data. You can drill down deeper to make optimum use of the user interface.
The dashboard provides a quick snapshot of the latest happenings in the Broker, where you can view the real time data coming from your devices. Along with raw data, you can expect the quick real time status of the broker.
Active Devices – Devices that are currently active
Total Devices – Total number of devices connected so far to the broker
Events – Total number of messages / data published
Commands – Total number of messages / data received
Recent Events – The real-time view of recent data published.
Recent Device Log – The recent view on error occurred while connecting devices.
Recent Connections – The recent list of devices connected
Recent Disconnections – The recent list of devices disconnected
In addition to the default dashboard, MQTT Broker supports custom one which allows users to create multiple dashboards specific to their applications. Let us dig deeper to know how it can help for your application.
The usage of dashboard varies with the use-case & application and it is not fair to provide static dashboard for all IoT implementations. Hence, MQTTRoute supports creating custom dashboard with set of pre-built widgets to help users have better visualization specific to their application or industrial needs.
Unlike other MQTT Broker/servers you don’t need any third party plugin to visualize your data. You can create multiple dashboards with this functionality from the UI itself. As of now, MQTTRoute supports 9 pre-built widgets. Just lay out the widgets on the dashboard and provide a value-bringing visualization to your data.
List of widgets supported
Widgets support JSON data and TEXT. Make sure you create widget only for numerical data.
The steps to make 9 different types of widgets are listed below.
Click to know more on MQTT Topics.
(For example – JSON syntax will be like
{ “ KEY 1” : “ VALUE1 ” , “KEY2” : “ VALUE2 “ , “ KEY 3“ : “VALUE 3” }
Example for JSON data
{ “sensor” :”99″ , “temperature” : “90” , “status” : on” }
In the above data, sensor, temperature, status are referred to as keys and 99, 90 and ON are values for the keys.
For instance, if I want to display temperature data, I have to select the key as “temperature”. Then I have to enter unit for the data. As I have selected temperature as the key, I have given Celsius as unit. You can enter the right unit based on your data.
Color widget helps you view data in a coloured form. Also, you can set different colors for each optimum range of values.
The steps are the same as those of creating a TEXT widget.
Let 0 to 50 be normal speed, 50 to 100 be medium speed and more than 100 be High speed. Now check the steps below.
Line Widget allows you to create trend that is to view data that changes over time. This helps you create a series of values connected with a straight line. You can also compare changes over the same period for more than one value.
The steps are the same as those of creating a TEXT & Color widget. But there won’t be any option to set minimum and maximum range & offset as this is a trend chart.
As it is a trend chart, it displays data over time. Hence it is a chart of your data vs time. Data (value) will occupy y-axis and time will occupy x-axis. The subtitle & unit you provide will be displayed in y-axis.
Note : When chosen Historical data, you can export the data for your preferable period of days.
Comparing two or more values (data) of a single device can be done with line widget.
Follow the steps below to create data comparison chart.
The usage of Bar widget is the same as that of line widget and it represents data in rectangular bars with heights proportional to the values they represent.
As it is a trend chart, it displays data over time. Hence it is a chart of your data vs time, data (value) will occupy y-axis and time will occupy x-axis. The subtitle & unit you provide will be displayed in y-axis.
Note : When chosen Historical data, you can export data for your preferable period of days.
Comparing two or more values (data) of a single device can be done with bar widget.
Follow the steps below to create data comparison chart.
Gauge chart which visually illustrates a speedometer is used to represent progressive values.
The steps are the same as that of TEXT & COLOR widget.
Let us consider a pressure gauge and the data on pressure falls between the range 0 to 100. Now I can divide the dial into 5 different ranges.
0 to 20
20 to 40
40 to 60
60 to 80
80 to 100
Each category represents each offset and I will assign different colors for the same. The needle will hove over & point out the pressure value based on the data received in dial.
The usage of Vertical & Horizontal gauge is the same as that of Gauge but used to represent linear progressive values.
The steps for widget creation are exactly the same but you will have the linear scale (horizontal or vertical) instead of dial. You can set the offset based on this.
For step by step procedure, please check Gauge widget
It is a condition based widget which works for random data. It can be used in a scenario of checking the status of the device either active or inactive.
Follow the steps below to create LED widget.
Note : When chosen Historical data, you can export data for your preferable period of days.
Note : LED works only for the device which sends data in RANDOM. For example, On|Off or Open|Close
Now provide the value (ON) you receive when your device is active and (OFF) when device is inactive in the respective space given. Choose your desired color. Based on the color chosen, LED will blink representing the device status.
This is a user interactive widget where you can control the activity of device from the UI itself.
You can choose which kind of data you wish to get : Live or Historical
Based on the topic / event received by device, you can make your device ON / OFF or the action you need to perform with the subscribed data.
You can manually ON/OFF the device with the switch widget.
Note : When chosen Historical data, you can export data for your preferable period of days.
Note : Make sure the device you want to control is subscribed to the topic that has random data (ON / OFF or Open / Close).
This tab displays complete the list of devices (both active & inactive) that are connected to the MQTT Broker. Devices tab provides you a high level view on each device connected.
Let us dig deeper to know how the ‘Devices’ tab can help.
Dashboard can provide the latest quick events of devices. But how can we get the complete list of events published? and the commands received if it is a subscriber.
How can I send an instant command to the devices?
All these questions can be answered if you can make the optimum use of ‘Devices’ tab.
The complete list of events published by the device selected.
You can also get,
The list of messages published along with its associated topics by the selected device.
The complete list of commands subscribed by the device selected.
You can also get,
This is nothing but the list of topics subscribed by the particular device.
‘Send Command’ helps you to send instant messages to other devices.
Follow the steps to send an instant command :
The absolute list of topics published and subscribed by all devices connected to the broker.
The Rules are the first step to build intelligence to the broker. It is an automation engine where you can create alert based on the message received .
The rule engine comprises of Condition-based & Time based rules.
This rule type enables you to create rules based on client & the topic it is associated with.
Let us consider the scenario. My publisher is publishing the data with the topic, pub/test in 2 minutes interval. And I want my subscriber with the topic sub/test subscribed to know that publisher is publishing the data or not.
So, I can create a rule that whenever the Publisher sends data, the subscriber will receive the message ‘Message Sent’.
Note : This is just an example scenario, you can create your own rule based on your need.
If it has multiple topics, select the topic for which you are intended to generate a rule.
Now enter the topic which is about to receive the random message (yet to configure in rules)
Note : Device whichever is subscribed to this topic will receive the message configured.
Enter the message to be sent & click submit.
Alternatively, if you would like to send the message as it is from the publisher, click ‘forward’. This will forward the messages published as it are to the subscriber.
This rule type enables you to send a response based on the message received and it is associated only with the topic & not with the device. (i.e) You can create rule specific to any publishing topic & it is not limited to the device associated with.
This rule type will be helpful for the below mentioned scenario.
Let us consider my temperature sensor is publishing the temperature data in a range 0 to 50 and if it reaches the optimum value of 50, I have to send an alert message to the subscriber. So with topic & message rule type, I can set the condition that, if the data received is = 50, then send an alert message ‘Temperature High’.
Note : This is just an example scenario, you can create your own rule based on your need.
Now enter the topic which is about to receive the random message (yet to configure in rules)
Note : Device whichever is subscribed to this topic will receive the message configured when the condition set is satisfied.
Enter the message to be sent & click submit.
Alternatively, If you would like to send the message as it is from the publisher, click ‘forward’. This will forward the messages published as it are to the subscriber on satisfying the condition set.
This rule type enables you to send a response based on the message received and it is associated with both topic & message (i.e) You can create rule specific to any publishing topic that is associated with the particular device.
The steps are the same as those of Client-Topic-Message rule type.
Note : Device whichever is subscribed to this topic will receive the message configured when the condition set is satisfied.
Enter the message to be sent & click submit.
Alternatively, if you would like to send the message as it is from the publisher, click ‘forward’. This will forward the messages published as it are to the subscriber on satisfying the condition set.
Timer Rule – Rule creation based on the given date and time.
Timer rule helps in scheduling the rule to execute it in a preferred date & time. (i.e) You can send an alert for the specified date & time.
Once done, the alert will be received by the subscriber client for the mentioned date & time.
The connection of device with the broker may be restricted / interrupted due to so many reasons. The Device Log tab contains a list of errors occurred while connecting a device to the broker. This helps you know the reason behind the failure.
The below list helps you to identify the reason for the error.
ERROR | REASON |
---|---|
Server busy | Server busy, number of socket connection exceeded Server physical limit reached |
Unknown Client | Client details are not given properly. Invalid Client details provided |
Client id Null | Client id Null, Connection entry restricted Client Identifier is NULL |
Connection Refused | Same client id already found, try to connect with another client id Reusing an existing Client Identifier not allowed |
Invalid Credential | Username or password wrong. Connect with the correct user credential. Invalid Authentication Details Provided |
Ping Response Failed | Device went offline. TCP Timeout occurred. |
SSL Accept | Error while establishing a secure connection. Invalid SSL Certificate or Connection |
Protocol Not Supported | Invalid Protocol. The Received message is not in proper MQTT Format |
Socket Closed | Server is busy |
Device Disconnected Unexpectedly | device disconnected |
Here is everything a developer can make use of MQTTRoute for advanced configurations & implementation
The complete details on MQTT Broker Installation, basic features and configurations are available in ‘FOR BASIC USER’ Tab.
For advanced configurations & integrations, you can check here.
The Broker can be run in TLS mode, there by making the communication more secure.
To enable TLS, follow the steps below
As TLS is enabled, broker will start running in the port 8883 instead of 1883.
Note : WSS_PORT_NO is to start the MQTT SSL version in Websocket
By default, MQTTRoute comes with Self-Signed Certificates whose paths are set in broker.conf. If any other Certificates are used, these paths must be set accordingly.
You can find the certificate inside Certificate folder ../MQTTRoute/Certificate.
You can find the details about the certificates provided here.
You can upload these certificates (Server or Root certificate) to your device or client side.
If you need to create your own self-signed certificate, check below.
This will ask for the following details.
You can modify the details based on your need.
$ openssl genrsa -out server.key 2048
$ openssl req -new -out server.csr -key server.key
Please enter the following ‘extra’ attributes to be sent with your certificate request.
Note: These details can be modified. Ensure that the details filled in for root and server are not exactly the same.
Upload the created certificates in the respective folders.
Finally, make sure you’ve enabled TLS in broker.conf.
Check Connecting Devices via TLS / SSL Tab for detailed steps
In this example, we will use certbot to generate LetsEncrypt Certificate and use that certificate to enable a secure TLS communication between MQTTRoute and its clients.
The certificates will be created and saved in /etc/letsencrypt/live/ <your_domain >
Set the paths of these generated certificates in Bevywise/MQTTRoute/conf/broker.conf
You will then be prompted to enter applicable Distinguished Name (DN) information, totalling seven fields :
You can modify the details based on your need.
Again, navigate to the bin folder of openssl and enter the following commands:
You will then be prompted to enter applicable Distinguished Name (DN) information, totalling seven fields :
Please enter the following ‘extra’ attributes to be sent with your certificate request.
Note: These details can be modified. Ensure that the details filled in for root and server are not exactly the same.
Enter the following command in the prompt
Upload the created certificates in the respective folders.
Finally, make sure you’ve enabled TLS in broker.conf.
Check Connecting Devices via TLS / SSL Tab for steps
In this example, we will use certbot to generate LetsEncrypt Certificate and use that certificate to enable a secure TLS communication between MQTTRoute and its clients.
Download the latest version of the Certbot installer for Windows from the url, https://dl.eff.org/certbot-beta-installer-win_amd64.exe.
Open the Windows Start Menu and launch Windows PowerShell as an Administrator.
Enter the following commands to request a free Let’s Encrypt SSL certificate.
PS> certbot -d <your_domain>
The certificates will be created and saved in live folder of installation directory.
Set the paths of these generated certificates in Bevywise/MQTTRoute/conf/broker.conf
The options to configure how data is stored by the Broker is set in Bevywise/MQTTRoute/conf/data_store.conf
Device Information (Device IDs and Subscriptions) and MQTT Payload (Published/Received messages) are stored by the broker in one of the relational databases, by default. The relational databases supported by the Broker are: SQLite, MySQL, MSSQL and PostgreSQL. The UI uses this database.
However, if the data needs to be stored in some other database, outside the Broker, then it can be configured too.
To store both Device Information (Device IDs, Subscriptions) and Payload (Published/Received messages) in database,
If you don’t want to store both Device Information and Payload in database, then set
In this case, MQTTRoute UI is NOT available. Hence, PAYLOAD_TO_DB is assumed to be DISABLED.
To store only the Device Information in database and NOT the MQTT Payloads, set
In this case, only device information can be seen in the UI.
Let us see the Relational Database Configurations below.
SQLITE is the default storage option in MQTTRoute. And by default, Broker will store data in SQLITE.
You can check the configurations set in data_store.conf. DB_SERVER will be set in SQLITE.
Also, check SQLite Server information. A sample configuration is given below:
SQLite database will be stored in path Source/Bevywise/MQTTRoute/data
To configure MySQL Server as the relational database used by MQTTRoute, set in Bevywise/MQTTRoute/conf/data_store.conf
Also, set MySQL Server information. A sample configuration is given below.
Note : The server configuration needs to be get from your MySQL server.
To install MySQL, please refer the MySQL installation tab.
To configure MSSQL Server as the relational database used by MQTTRoute, set in Bevywise/MQTTRoute/conf/data_store.conf
Also, set MSSQL Server information. A sample configuration is given below
In Linux, set SERVER_NAME as the value of ‘Description’ in file: /etc/odbcinst.ini
To configure PostgreSQL Server as the relational database used by MQTTRoute, set in Bevywise/MQTTRoute/conf/data_store.conf
Also, set PostgreSQL Server information. A sample configuration is given below
To configure MQTTRoute to store only MQTT Payload in Elasticsearch, set in Bevywise/MQTTRoute/conf/data_store.conf
Elasticsearch configuration must be set as required.
In case, along with the requirement to store Payload in Elasticsearch, complete UI is also required, then set
If PAYLOAD_TO_DB = DISABLED, then Payload will be stored only in Elasticsearch.
A sample format of payload data stored in Elasticsearch is as follows
To configure MQTTRoute to store only MQTT Payload in any external database in a custom format, set in Bevywise/MQTTRoute/conf/data_store.conf
In this case, the MQTT Payload received from devices are available at a method handle_Received_Payload(data) and MQTT Payload sent to devices are available at a method handle_Sent_Payload(data).
These two methods must be defined in a Python file whose path must be set in INTERCEPT_FILEPATH.
How to store MQTT Payload data in MongoDB?
The features of MQTT Route is provided with certain extensions to make it flexible for users. You can customize it based on your needs.
Refer to Configuring MQTT Route to store MQTT Payload data in custom database
By default, the authentication of devices is done by the Broker. But, if authentication needs to be done outside the Broker, then this option can be used by setting in Bevywise/MQTTRoute/conf/broker.conf
Then, set REMOTEAUTH_ENABLED to Yes
In this case, the Username/Password sent by devices are received at the method handle_Device_Auth (username, password, clientid, ipaddress) defined in a Python file whose path can be set in INTERCEPT_FILEPATH in broker.conf.
A sample file with this method(handle_Device_Auth()) definition is available in Bevywise/MQTTRoute/extensions/custom_auth.py, where this method is defined to send Username, Password, ClientId and IP address via POST Request to an external API which does the authentication.
This method can be modified to suit the needs, if required.
Note : You can also implement this method in your own file & specify the path in INTERCEPT_FILEPATH in broker.conf
AI / ML plays a major role in any IoT Implementation. So the data received from the different sensors need to be modeled and stored to any BIG data engine for further analysis and decision making. MQTT Route provides an option called the custom store to receive data at the back end to be stored as needed.
Custom Store implementation is used to hook the received payload from MQTTBroker and store the payload in any of your analytics / big data engine. To configure, you must enable the CUSTOM STORAGE in data_store.conf.
You need to enable CUSTOM STORAGE to receive the data of the message received from the devices into a python call back handle_Received_Payload (data) . This method need to be implemented in the python file specified in the INTERCEPT_FILEPATH.
The data will be passed in a JSON format with the following keys – ‘sender’, ’topic’, ‘message’, ‘unixtime’, ‘timestamp’
Your implementation should receive the data and store it and return the method. We advice you to just store the data or hand over the data to a stream analysis and return the method handle. Below is the custom_store.py file
UI custom server provides an option to customize the user interface. You can alter the code in Custom_ui_server.py file as you need to customize it. You will be able to configure your dashboard to view device data as per your needs. You can add your own requirements, device details or notifications to the user interface as required. The UI custom server will help you customize the UI of the MQTTRoute by adding your own code on the server-side. Add your new functionality using the URL and the corresponding method. These URLs can be invoked from your User Interface for manipulating data.
The Scheduler allows easier scheduling of tasks to be broadcasted. Scheduler can be configurable by the user using the custom_scheduler.py file. The Custom Scheduler will help you create your own schedule in MQTTRoute by adding your own code on the server-side. SQL connector will be provided as cursor global variable for querying the Database & Elastic Search connector for querying Elastic if you have enabled custom storage option.
Bevywise MQTT Broker performs SYS topic, which helps developers monitor the present status of the MQTT Broker rapidly.
MQTTRoute periodically publishes information about itself to SYS Topics.
To enable this, set in Bevywise/MQTTRoute/conf/broker.conf
The SYS topics that are supported and sample messages are listed.
TOPIC | MESSAGE |
---|---|
$SYS/broker/version | Bevywise MQTTROUTE Version 4.0 |
$SYS/broker/uptime | 0 days 0 hours 2 minutes 15 seconds |
$SYS/broker/clients/active | No of Clients online: 1 |
$SYS/broker/clients/total | Total Client Count: 1 |
$SYS/broker/messages/receive | Total Packets received: 10 |
$SYS/broker/messages/sent | Total Packets Sent: 7 |
$SYS/broker/subscriptions/count | Total Subscriptions: 2 |
$SYS/broker/Total_ACK/sent | Total ACK sent: 10 |
A device can start receiving these messages after subscribing to one or more of these topics, or to ‘$SYS/#’ or ‘#’.
To ensure High Availability, more than 1 MQTTRoute Brokers can be used. Our MQTTRoute with the built-in Inter-Broker Communicator (IBC) enables all the brokers in the cluster to talk to each other ensuring continuous communication with the devices both ways irrespective of clients getting connecting to any broker in the cluster.
A load balancer can be set up at the device-facing edge to balance the load.
To learn more about the inter-broker communicator functionality, read our high availability blog.
To enable High Availability in MQTTRoute, you should activate the inter-broker communicator first.
The built-in Inter-broker Communicator (IBC) feature ensures seamless communication among all brokers within a cluster. This guarantees continuous connectivity with devices in both directions, regardless of which broker clients connect to.
To enable IBC after installing MQTTRoute on broker machines, modify the configuration in Bevywise/MQTTRoute/conf/broker.conf as follows:
IBC_Enable = YES
Port = 8082
The illustration below demonstrates the setup:
In this arrangement, two or more brokers with IBC enabled are grouped to form a cluster. A load balancer is then configured to distribute workloads evenly across these brokers. All MQTT brokers within the cluster remain active, and IBC within each broker ensures persistent communication by utilizing a shared database (DB). This means that brokers do not directly communicate with one another. Instead, they push data to the central database, allowing other brokers to access this data. As a result, every broker has access to client details and data.
Note: You have the flexibility to select any load balancer that suits your needs.
For a more comprehensive understanding of Nginx load balancer configuration, we recommend checking out our detailed blog on high availability.
If you've opted to use Azure as your load balancer, we suggest referring to our dedicated blog post on Azure load balancer configuration for enhanced clarity.
Refer the following Github page for enabling Protobuf support.
MQTTBroker as a Service in Linux
To run the MQTTBroker as service, we need the Monit version 5.25. Monit is an open source dynamic monitoring tool for Linux systems which is used for monitoring and managing system processes. And also, it performs automatic maintenance or repair of a particular process (i.e., restarting the service) and execute significant informal actions in error conditions whenever necessary.
Copy monitrc file and paste in below location
Enable the HTTP interface by un commenting the following lines in /etc/monitrc file.
If you want you can change admin:monit with username and password you want to use
Open Monit UI using the below URL in your web browser http://localhost:2812
In that add,
To check:
This section of the MQTT Broker tutorial explains the functions and the options to work with the Gateway bundled with the MQTT Route. The MQTT Gateway acts as an intermediate agent between the Sensors and the MQTT Broker. The MQTT Gateway has inbuilt functionality to discover all the sensors that run around the gateway. The gateway advertises itself and its Clients will be able to search for the gateway in return.
The gateway can be started in two modes
Aggregated Gateway – The gateway will make only one connection with the central MQTT Broker and will aggregate all the messages from the individual sensors and send it to the broker via the single connection. This will reduce the load on the Central Broker.
Transparent Gateway – This gateway will just act as a forwarding agent and each sensor will be individually connected to the central broker.
The gateway supports the accumulation of messages when the client goes for a sleep state and sens all the messages when the client comes back.
Note : Without Bluetooth, MQTT Gateway will not work. So, enable Bluetooth in your PC and follow the below steps.
Start the Gateway after starting the MQTT Route.
For Windows :
To start MQTT Gateway in other OS :
The Gateway can be configured using the gateway.conf file inside the conf folder.
To check whether MySQL is already installed or to open the MySQL monitor, follow the below steps.
Install the MySQL package by executing the below command :
Package configuration window will appear. In that choose the first option and click Ok.
In the next window, select your desired product and hit Enter to
continue.
Select the last option and press Enter to proceed further.
Next step is to update the APT repository. Use the following command to
update it :
sudo apt update
If needed, you can install MySQL Server and client. You need to run the below command to install MySQL server and client. Press ‘Y’ to begin the installation. Provide password for the root user when asked.
In the next window, provide a password for the root user. Go through the information about the authentication system based on SHA256-based password methods. Then choose the authentication plugin. The installation gets started and MySQL 8.0 will be installed in your system.
MySQL is successfully installed. Use the below command to access MySQL monitor or to verify the installation of MySQL
To integrate MQTT Broker with MySQL we need to have certain dependencies installed.
To make it easy we do provide installer file named install_mysql_connector.sh which on running will automatically install all required dependencies in your system.
You can find the file inside .Bevywise/MQTTRoute/bin.
Run the file using the command below
Now the MySQL connector is installed in the required repository. Then its time to configure MQTT Broker to accept MySQL as a database. Please check the MySQL configuration tab.
1. Python 3.7
2. Pip 3.7
Note: The above dependencies shall be skipped if it is already installed on PC.
Install MySQL 5.7 server or higher.
DB_SERVER = MYSQL
MYSQL_USER= < username>
MYSQL_PASSWORD = < Password>
Note: Please don’t use XAMPP or MAMP for MySQL.
Once you run the installer.bat file, python3 will automatically download and the installation will start.[Python installation steps shall be skipped, if it was already installed]
Follow the below steps to install python3:
We pack variety of features & functions in MQTT Broker app to visualize, monitor & control MQTT devices / data on your smart phone. The new mobile app works in conjunction with MQTTRoute that helps you take complete control over your MQTT-enabled devices connected to the MQTTRoute. MQTTRoute App is available on Google Play Store. Here is the direct link to install MQTTRoute App from Play store.
Download & install our app from Google play store on your android smart phone.
Define the IP / Domain in which the MQTTRoute is running
Provide the Username and Password of your MQTT Broker. By default, Username – admin, Password – admin. If you have changed the username & password already, use that.
Once done, you will be able to access the MQTT Dashboard with the latest happenings in the MQTTRoute.
Start accessing & creating a dashboard specific to your application. You can create multiple dashboards & configure the user interface in the way you need.
View Device details, Events, recent connects & disconnects & more in the Dashboard.
To visualize data specific to your application, create & develop multiple dashboards with pre-built widgets.
Click ‘+Dashboard’ & follow the steps mentioned in custom dashboard section to create multiple dashboards with widgets.
Enter Dashboard name that you are yet to create and provide ‘Description’.
Now click ‘+ widget’ & choose your desired widget from the list.
Then enter the necessary details about the device for which you need to visualize data. Here we have attached screenshots on creating Line widget. The same steps should be followed for all the available widgets.
Bevywise MQTT Broker works seamlessly with any application. The below mentioned articles provide step by step instructions to integrate MQTT Broker with such applications.
This gives you the details about the MQTTRoute Product Package. When you unzip the file, a folder named ‘Bevywise’ will be created. The contents of the Broker are in Bevywise/MQTT_Broker location.
This folder contains the executable file required to run Bevywise MQTTBroker. The runbroker.sh file runs the broker using the python executable file.
This folder contains a secure SSL/TLS certificate. The client and server contain a common CA certificate root.crt file which is the Certificate Authority to verify the clients and the server. client/ will have the client.crt certificate file and client.key file for the certificate. server/ will have a server.crt certificate file and server.key key file for the certificate.
In this folder, the configuration file for the broker is stored. The properties like Broker Port, TLS Port, Enable/Disable TLS and Authentication of the user can be configured using the broker.conf file.
This folder contains the SQLite database that stores all the details of the broker. When the broker runs, the database is created.
This folder contains the core libraries of Bevywise MQTTBoker.
This folder contains the open source license agreement and license file of the MQTTBroker libraries.
This folder contains the required files for the User Interface. You can see the user interface from your browser using 127.0.0.1:8080.
A text file which guides the user step by step to run the Bevywise MQTTBroker.
This section is for premium users who bought license from us for the advanced use of MQTTRoute functionalities.
The premium users will be provided with license.dat file to be uploaded in MQTTRoute.
Your license is upgraded now. To verify, run the MQTTRoute in terminal. Terminal displays the premium version you are using.
We are with all ears waiting to hear from you. Post us with your questions and feedback.
Write to us