MQTT broker in the Lazur cloud

I have a backend device with an MQTT client connected to an open source MQTT broker (Mosquitto). On the other hand, I have many interface devices (PC, tablet, mobile) with a graphical interface, also associated with a broker. Thus, here Mosquitto works as a point of communication between the backend device and external devices and only transmits messages between them. Sometimes the amount of data transferred can be quite high (for example, 1 MB / min).

One backend device + many interface devices - this is one installation. I need to prepare the infrastructure for thousands of such installations, operating simultaneously. Therefore, my service must be very dangerous. My company uses Azure cloud solutions, so I started to learn this solution, and I have to admit that I'm a little confused. I read that I need to use an IoT hub, but it will require an MQTT Gateway to work with MQTT devices. On the other hand, if I understand this well, Gateway should work on some virtual machines, so I lose the scalability of my solution. I'm right? Now, if I need to support 100 thousand. Or 500 thousand. Devices, will I need another virtual machine? Another thing is that I need to integrate all this with some webservice (for managing internal and external devices), so I need some connection between webservice and the MQTT broker ...

Before I started playing with Azure, I thought that I just launched the MQTT brokerage service, and, by magic, it will be very vulnerable and will be able to serve thousands of devices.

Can someone explain to me how to bite this?

+6
source share
2 answers

There is no official support for the MQTT protocol in Azure today, but only a public preview of the IoT hub that supports AMQP and HTTP. To connect MQTT devices to an IoT hub, Microsoft provides an “infrastructure” called IoT Protocol Gateway ( https://github.com/Azure/azure-iot-protocol-gateway ) that performs protocol conversion between MQTT and AMQP. The IoT Gateway can be installed indoors or in the cloud as a working Azure role. In the second scenario, you have the scalability offered by Azure and associated with instances of the work role. This solution is completely new due to the short life of the IoT hub (still open) and the IoT protocol gateway itself.

Your first decision is based on the use of a third-party MQTT broker (for example, mosquitto), which you must install in a virtual machine. AFAIK mosquitto does not support clusters such as HiveMQ broker (see Another answer here: Creating a cluster with Mosquitto broker ).

The last thing about the connection between your web service and the MQTT broker. In this case, the web service must transfer calls to it (from the external end) to the published message in the MQTT broker using the MQTT client, which must be enabled inside the web service itself.

Even if you use AWS, the following link may be useful: https://groups.google.com/forum/#!topic/mqtt/19jqofoPLro

Paolo

+2
source

Azure IoT Hub now speaks MQTT natively. A protocol gateway is no longer required. https://azure.microsoft.com/en-us/documentation/articles/iot-hub-mqtt-support/

This will help you a lot if you just spent the last hour trying to generate your MQTT username and password: https://github.com/Azure/azure-content/blob/master/articles/iot-hub/iot-hub-devguide .md # example

Example:

Username (DeviceId is case sensitive): iothubname.azure-devices.net/DeviceId

Password (generate SAS using the device explorer): SharedAccessSignature sr=iothubname.azure-devices.net%2fdevices%2fDeviceId&sig=kPszxZZZZZZZZZZZZZZZZZAhLT%2bV7o%3d&se=1487709501

Tested with Paho and MQTT.fx on Windows. I was not able to authenticate with mosquitto , and I made a reasonable effort, even tried using stunnel just in case mosquitto TLS support didn't cut it. Mosquitto probably doesn’t handle a long password or something like that. It throws an authentication error. Reset % and & did not help.

If someone gets Mosquitto to work with the Azure IoT Hub, please open my eyes.

+6
source

All Articles