HiveMQ on Windows Azure – MQTT in the Microsoft Cloud
Infrastructure as a Service (IaaS) providers like Microsoft Windows Azure and Amazon Webservices (AWS) are excellent choices for building reliable and scalable infrastructures for your service or platform and are a very good alternative to hosting your own hardware boxes in a computing center on your own. In this post you will learn how to get the HiveMQ MQTT broker up and running in minutes on the Microsoft Windows Azure Cloud – of course with Websockets enabled!
This will explain how to install HiveMQ on an Azure Linux VM. The steps may vary when using Windows as operating system. If you want use the native Websockets implementation of HiveMQ to enable MQTT over Websockets, please make sure you follow all steps which are marked as optional.
As a prerequisite, you need a valid Windows Azure Account. If you haven’t created one yet, start with that here.
- Create a new Virtual Machine via the Azure Web Interface. Select the newest Ubuntu LTS as Image.
- After the Virtual Machine was created, we have to open the standard MQTT port which happens to be 1883. Go to the Endpoint Settings of your VM in the Azure Web Interface and add a new Endpoint. Use TCP as protocol and set the public and private port to 1883.
- optional: Create another endpoint for Websockets. Use TCP as protocol and set both ports to 8000.
- Now connect to your server instance via SSH.
- Execute the following command to install all required dependencies:
1sudo apt-get install unzip openjdk-8-jdk
- Download the latest HiveMQ version with the following command:
(Replace YOUR-HIVEMQ-DOWNLOAD-LINK with your personal download link which you get from the HiveMQ Download page)1wget --content-disposition <YOUR-HIVEMQ-DOWNLOAD-LINK>
- Unzip HiveMQ:
- Start HiveMQ:
And now we have a HiveMQ MQTT server up and running in the Microsoft Windows Azure Cloud with Websockets support. You can try any MQTT tool you like to test the broker. Or you could just use the Websockets MQTT client. Just make sure you use the correct port, which is 1883 for MQTT and 8000 for Websockets.
We have seen it’s very easy to get a HiveMQ instance up and running in the Azure Cloud. Since HiveMQ is extremely portable, it runs on Linux and Windows Azure Virtual Machines. Of course you can gain a new dimension of scalability if using Azures load balancing with HiveMQs built-in cluster functionality.
Do you use or plan to use an IaaS provider? Have you tried Azure for your services, yet? Let us know in the comments!