The EMQ broker is one of the most interesting MQTT brokers.
EMQ is fully open source and licensed under the Apache Version 2.0. EMQ implements both MQTT V3.1 and V3.1.1 protocol specifications, and supports MQTT-SN, CoAP, WebSocket, STOMP and SockJS at the same time.
EMQ provides a scalable, reliable, enterprise-grade MQTT message Hub for IoT, M2M, Smart Hardware and Mobile Messaging Applications. Sensors, Mobiles, Web Browsers and Application Servers could be connected by EMQ brokers with asynchronous PUB/SUB MQTT messages.
Take a look at emqtt.io for more info.
EMQ is written in erlang, so to compile and run EMQ you have to install erlang
Let’s start
sudo apt-get update sudo apt-get install wget sudo apt-get install libssl-dev sudo apt-get install ncurses-dev wget http://www.erlang.org/download/otp_src_19.2.tar.gz
This will download about 60MB of tarballed archive.
Time to compile ERLANG
tar -xzvf otp_src_19.2.tar.gz cd otp_src_19.2/ ./configure
it will take about 150 seconds
Build erlang , this could be a very long operation, on raspberry pi it will take about 200 minutes, on raspberry pi 3 it will take about 10m36.317s running make -j 4 (on raspberry pi you have to run make without options)
make -j 4 sudo make install cd .. rm otp_src_19.2.tar.gz sudo rm -R otp_src_19.2/
So, now you have installed erlang. Let’s install EMQ:
git clone https://github.com/emqtt/emq-relx.git
Build the emqtt broker running the following command.
cd emq-relx && make
Note that in this case you cannot use the -j option of the make command, because the build will fail.
cd _rel/emqttd && ./bin/emqttd console
Now you are running your EMQ broker.
Gg1.
That was awesome! not 1 error following this guide!
I’d like to configure it to auto start as a daemon when the Rpi is started…
How do I do that?
Thanks!
HI, I’m also with Nahuel. Great instructions, not 1 issue other than starting at boot, any pointers?
Hi!
I’m currently trying compile erlang in my Orange Pi zero, but failed building emq-relx because the makefile needs OTP 21 or higher version.
You can correct this article by downloading erlang from the github, and building the latest version from it:
https://github.com/erlang/otp
There are also some instructions to how to build, you can follow them.
~/emq-relx $ make
Makefile:54: recipe for target ‘OTP_21_OR_NEWER’ failed
make: *** [OTP_21_OR_NEWER] Error 1
Hardware: RASPBERRY3
2018-11-13-raspbian-stretch-lite