Introduction
EMQ X Edge is an open source, lightweight MQTT broker at any resource constraint edge devices.
EMQ X Edge is fully open source and licensed under the Apache Version 2.0. EMQ X implements both MQTT V3.1/V3.1.1. and V5.0 protocol specifications, and supports MQTT, TCP, WebSocket and different industry protocols such ModBus.
EMQ X Edge can be running at different kinds of resource constrained edge devices, such as Raspberry Pi, gateway and industrial servers. And as the bridge betweewn the local terminals and the remote broker, EMQ X Edge provides local data processing and cloud synchronization which will automatically synchronize data with cloud service based on network status.
Get Started
Overview
EMQ X Edge is written in Erlang/OTP, and Erlang/OTP is a concurrent, fault-tolerant, soft-realtime and distributed programming platform. MQTT is an extremely lightweight publish/subscribe messaging protocol powering IoT, M2M and Mobile applications.
Highlights of the EMQ X Edge Broker:
โข
It supports MQTT, TCP, WebSocket and different industry protocols such ModBus.
โข
It can be runninbg at different kinds of resource constrained edge devices, such as Raspberry Pi, gateway and industrial servers.
โข
It provides local data processing and cloud synchronization which will automatically synchronize data with cloud service based on network status.
โข
Integrated with EMQ X Storm which provides central monitoring and management services.
Features
โข
Lightweight - 20MB runtime memory with minimal resource consumption, which can run on ARM/x86 CPU, from Raspberry Pi to industrial X86 servers.
โข
Near real-time response - processing the data generated locally, so it can respond quickly to local events.
โข
Operate online or offline - it operate locally and can cache data when network is not available; when they're back online it can synchronize data to the cloud and use the cloud for management, analysis and date persistence.
โข
Easy management & monitoring - central edge broker management, data synchronization, visualized monitoring tools based on web UI.
โข
Extensibility - Open APIs available to third party plugins to support more protocols, new functions and features.
Quick Start
Download and Install
The EMQ X Edge is cross-platform, which could be depolyed on Raspberry Pi, Linux and FreeBSD.
Download binary package from:ย http://emqx.io/downloads
Installing on Linux, for example:
Installing from Source
The EXQ X Edge broker requires Erlang/OTP R21+ to build since 3.0 release.
Plugins
The EMQ X Edge broker could be extended by Plugins. A plugin is an Erlang application that adds extra feature to the EMQ X Edge broker:
A plugin could be enabled by 'bin/emqx_ctl plugins load' command.
For example, enable 'emqx_auth_mysql' plugin:
MQTT Client Libraries
GitHub:ย https://github.com/emqtt
Eclipse Paho:ย https://www.eclipse.org/paho/
Installation
The EMQ X Edge broker V3.1 supports CentOS, Alpine, Raspbian, Debian, Ubuntu and Docker.
Download Packages
Download binary package from: https://www.emqx.io/downloads/edge
The following OS types are supported:
โข
CentOS6.8
โข
CentOS7
โข
Debian7
โข
Debian8
โข
Debian9
โข
Alpine3.8
โข
Raspbian8
โข
Raspbian9
โข
Ubuntu12.04
โข
Ubuntu14.04
โข
Ubuntu16.04
โข
Ubuntu18.04
โข
Docker
The package name consists of platform, version and release time.
For example: emqx-edge-centos7-v3.1-beta1.zip
Install via zip
Select and download zip package from https://www.emqx.io/downloads/edge (opens new window) , and then unzip:
Start the Edge broker in console mode:
If the broker is started successfully, console will print:
CTRL+C to close the console and stop the broker
Start the broker in daemon mode:
Check the running status of the broker:
Or check the status by URL:
Stop the broker:
Install via RPM
์๋ต.
Install via DEB
์๋ต.
Install via Docker Image
Select Docker group from https://www.emqx.io/downloads/edge, and download EMQ X Edge 3.1 Beta1 Docker Image.
unzip emqx-edge-docker image:
Load Docker Image:
Run the Container:
Stop the broker:
Start the broker:
Installing From Source
์๋ต.
TCP Ports Used
The TCP ports used can be configured in etc/eqmx.config:
Quick Setup
Two main configuration files of the EQM X Edge broker:
Two important parameters in etc/emqx.conf:
node.process_limit > maximum number of allowed concurrent clients * 2
node.max_ports > maximum number of allowed concurrent clients
The maximum number of allowed MQTT clients:
/etc/init.d/emqx
chkconfig:
์ฐ๋ถํฌ์์๋ chkconfig ๋ช
๋ น์ด๋ฅผ ์ง์ํ์ง ์์
"https://stackoverflow.com/questions/20680050/how-do-i-install-chkconfig-on-ubuntu"
๋ฅผ ์ฐธ๊ณ ํ์ฌ "update-rc.d <service> defaults" ์ฌ์ฉ
boot test:
erlexec: HOME must be set uncomment '# export HOME=/root' if "HOME must be set" error.
Configuration
Plugins
My Test
Install Erlang
Install emqtt bench and Usage
Test Command
./emqtt_bench pub -h ec2-13-125-242-175.ap-northeast-2.compute.amazonaws.com -c 300 -I 1000 -t battery/%i -s 80 -q 2
Bash
๋ณต์ฌ
โข
Connection count(-c): 300
โข
Interval of publishing message(-I): 1000ms
โข
QoS Level(-q): 2
โข
Topic(-t): "battery/%i"
โข
Payload size(-s): 80
๋ฐ์ฌ๋ ํผ๋๋ฐฑ
โข
SSL ๊ณ ๋ ค
โข
๋จ์ผ ๋จธ์ ์์ ์์ฑํ๋ 300๊ฐ ์ปค๋ฅ์
๊ณผ ์ฌ๋ฌ ๋จธ์ (300๊ฐ)์์ ์์ฑํ๋ 300๊ฐ ์ปค๋ฅ์
์ ๋ค๋ฅผ ์ ์๋ค๊ณ ํ์ฌ
โข
ํด๋ผ์ฐ๋ ๋น์ฉ๋ ๊ณ ๋ ค ํ์ โ ์ด๊ฑด ๋ด ์๊ฐ