Try the HiveMQ MQTT broker on CentOS 6.x

Posted on Tue 18 June 2013 in IoT

What is MQTT?

MQTT is the short name for MQ Telemetry Transport. It is a TCP based protocol which implements the publish and subscribe pattern. While the pubish and subscribe method became popular these days for mobile devices MQTT is one of the protocols becoming more and more popular. Actually MQTT is becoming an OASIS standard for the Internet of Things within the next few months.
Some more information are available here:

What is HiveMQ

HiveMQ is a MQTT broker which basically is the server part of MQTT. All messages in a MQTT communication are handled by a broker, it is the key component for this type of communication. HiveMQ is a Java based broker software with some extended functionality like building clusters and the possibility to easily extend the functionality with plugins. It is free for personal non-commercial use up to 25 concurrent connected clients. Check out the HiveMQ Website for all its features and documentation.

Requirements

CentOS 6.x
Java VM (OpenJDK 1.7)
SELinux should be off if you don't need it.
Allow incomming connections to TCP port 1883

Install OpenJDK 1.7

yum install java-1.7.0-openjdk.x86_64

Download, extract and run HiveMQ

wget --content-disposition http://www.hivemq.com/downloads/releases/latest
unzip hivemq-1.3.0.zip
cd hivemq-1.3.0/
chmod 755 start.sh
./start.sh

The output should look something like this:

-------------------------------------------------------------------------

_    _  _              __  __   ____
| |  | |(_)            |  \/  | / __ \
| |__| | _ __   __ ___ | \  / || |  | |
|  __  || |\ \ / // _ \| |\/| || |  | |
| |  | || | \ V /|  __/| |  | || |__| |
|_|  |_||_|  \_/  \___||_|  |_| \___\_\

-------------------------------------------------------------------------

HiveMQ Start Script for Linux/Unix v1

-------------------------------------------------------------------------

Checking if Java is installed
Java was found. Starting HiveMQ....

-------------------------------------------------------------------------

No HIVEMQ_HOME is set, using default
Searching for HiveMQ in /hivemq-1.3.0....
DONE!
Starting HiveMQ...

-------------------------------------------------------------------------
2013-06-18 22:35:29,874 INFO  - HiveMQ home directory: /hivemq-1.3.0
2013-06-18 22:35:29,879 INFO  - Starting HiveMQ Server
2013-06-18 22:35:33,509 INFO  - Activating statistics callbacks with an interval of 60 seconds
2013-06-18 22:35:33,510 INFO  - Activating $SYS topics with an interval of 60 seconds
2013-06-18 22:35:33,812 WARN  - No license file found. Using free personal licensing with restrictions to 25 connections.
2013-06-18 22:35:34,483 INFO  - Starting on address 0.0.0.0 and port 1883
2013-06-18 22:35:34,514 INFO  - Loaded Plugin Access Log Plugin - v1.0-SNAPSHOT
2013-06-18 22:35:34,516 INFO  - Started HiveMQ in 4646ms

And that's it! Try to connect your client to your ip on port 1883 and have fun. If you want to use a plugin, just extract it into your plugin folder and restart HiveMQ.