Official documentation of Erlang, erlang.org/doc/man/

Emq official website: www.emqtt.com/

www.emqx.io/

Emq Jane books: www.jianshu.com/u/9cbcdf094…

MQTT debugging tool 1 (websocket not supported) : mqtt.fx

mqttfx.jensd.de/index.php

www.jensd.de/apps/mqttfx…

MQTT debugging tool 2 (websocket not supported) : org.eclipse.paho.ui.app, cross-platform/full platform, recommended

www.eclipse.org/paho/compon…

MQTT debugging tool 3 (websocket not supported) : QMQTT

github.com/emqtt/qmqtt

Github.com/emqtt/qmqtt…

Download.csdn.net/download/li… — Firecat uploads the maintained version

MQTT debugging tool 4 (websocket support) : We can use the Dashboard plug-in of EMQ to conduct websocket debugging, open Google Browser and enter the url, where 192.168.83.128 is the IP address of EMQ:

http://192.168.83.128:18083/#/websocket

User name: admin, password: public

WebSocket URI: ws (s) : / / 192.168.83.128:8083 / MQTT

TCP URI: TCP: / / 192.168.83.128:1883

MQTT debugging tool 5 (websocket support) : cross-platform/full platform, recommended

Workswithweb.com/mqttbox.htm…

 

Open Source projects:

github.com/emqx

github.com/emqtt

Github.com/emqx/emqx/t… — V1

Github.com/emqx/emqx-r… — V2

Github.com/emqtt/esock…

Github.com/emqtt/esock…

Github.com/emqtt/gen_l…

Github.com/emqtt/emqtt…

Github.com/mochi/mochi…

Github.com/uwiger/gpro…

github.com/basho/lager

Github.com/devinus/poo…

github.com/ferd/recon

 

Here are two important articles I wrote that you should read first:

Erlang OTP compilation under centos7

Erlang How to use observer:start() in Linux without a graphical interface.

 

+ + + + + + + + + + + + + + + v1.1.3 + + + + + + + + + + + + + + + + + + + + + +

Github.com/emqtt/emqtt…

cd emqttd make && make dist 

After successful compilation, the executable package is in the directory: rel/emqttd

Console launches the compiled EMQTTD package:

cd rel/emqttd && ./bin/emqttd console

./emqttd start

/emqttd stop./emqttd_ctl cluster join [email protected]./emqttd_ctl cluster status./emqttd_ctl cluster leave . / emqttd_ctl cluster remove [email protected]

 

Graphical monitoring

Install Erlang OTP on Windows, then enter at CMD prompt: werl-name [email protected].?? -setcookie emqttDsecretcookie or werl -name [email protected] -setcookie emqttdsecretcookie observer:start(). The shell then enters the terminal command observer:start(). In the pop-up dialog box, click On Menu Nodes->Connect Node and enter the Node name for Linux [email protected]

[email protected]

The emq1.0 and 2.0 architectures have changed a lot, with different ways of compiling and downloading. 2.0 requires OTP version 19.1 or higher, I use 19.3.

 

+ + + + + + + + + + + + + + + + + + + + + + v2.3.11 + + + + + + + + + + + + + + + + + + + +

Github.com/emqx/emqx-r… Erlang OTP19.3 + version is required, we can use OTP19.3.

Download decompression completed, compile, compile process will automatically go to Github to download the relevant dependent library source code, the complete command is as follows:

If /bin/sh: git: command not found, git yum install -y git

Chmod -r 777 emqx-rel-2.3.11 #

CD emqx rel – 2.3.11 && make

cd _rel/emqttd && ./bin/emqttd console

Or. / _rel emqttd/bin/emqttd console

Or. / _rel emqttd/bin/emqttd start

        ./_rel/emqttd/bin/emqttd stop

Exit process method 1:

([email protected])1> q().

After the kill process emq runs, the process name on the Linux background is beam.smp

 

Compile and publish plug-ins:

The Makefile to increase

DEPS: DEPS += plugin_name

dep_plugin_name = git url_of_plugin 

Add the release paragraph to relx.config:

{plugin_name, load},

Compilation is done, / home/firecat/Prj/emq2.0 / emqx rel – 2.3.11 / data/loaded_plugins set to start the plugin

The path to the original configuration file, which is copied from here to _rel every time you compile it

/ home/firecat/Prj/emq2.0 / emqx rel – 2.3.11 deps/emqttd/etc/emq. Conf

/ home/firecat/Prj/emq2.0 / emqx rel – 2.3.11 / data/loaded_plugins

 

Starting emqttd on node '[email protected]' emqttd CTL is starting... [ok] emqttd hook is starting... [ok] emqttd router is starting... [ok] emqttd pubsub is starting... [ok] emqttd stats is starting... [ok] emqttd metrics is starting... [ok] emqttd pooler is starting... [ok] emqttd trace is starting... [ok] emqttd client manager is starting... [ok] emqttd session manager is starting... [ok] emqttd session supervisor is starting... [ok] emqttd wsclient supervisor is starting... [ok] emqttd broker is starting... [ok] emqttd alarm is starting... [ok] emqttd mod supervisor is starting... [ok] emqttd bridge supervisor is starting... [ok] emqttd access control is starting... [ok] emqttd system monitor is starting... [OK] EMqTTD 2.3.11 is running now Eshell V8.3 (abort with ^G) ([email protected])1> Load EMq_mod_presence module HTTP listen on 0.0.0.0:18084 with 4 acceptors. HTTP listen on 0.0.0.0:18084 with 4 acceptors. MQTT: TCP listen on 127.0.0.1:11883 with 4 acceptors. MQTT: TCP listen on 0.0.0.0:1883 with 16 acceptors. MQTT: WS listen On 0.0.0.0:8083 with 4 acceptors. MQTT: SSL listen on 0.0.0.0:8883 with 16 acceptors. MQTT: WSS listen on 0.0.0.0:8084 MQTT: API listen on 0.0.0.0:8080 with 4 acceptors.Copy the code

Note: When using XftpPortable, do not use Windows tablets to edit files such as emq.conf and loaded_plugins, otherwise the emqTTD process will not start due to different encoding.

 

Use graphical monitoring in Windows operating system

Install Erlang OTP on Windows and enter: werl-name [email protected] -setcookie emqsecretcookie at the CMD command prompt

Or werl-name [email protected].?? -setcookie emqsecretcookie observer:start().

The shell then enters the terminal command observer:start(). In the pop-up dialog box, click Menu Nodes->Connect Node and enter the Node name for Linux

[email protected]

 

The NAT network mode is recommended for Linux VMS because Ip addresses are fixed.

On the CLI of the Windows terminal on the dedicated server, enter: Werl-name [email protected] -setcookie emqsecretcookie or werl-name [email protected] -setcookie emqsecretcookie observer:start(). The shell then enters the terminal command observer:start(). In the pop-up dialog box, click On Menu Nodes->Connect Node and enter the Node name for Linux [email protected]

 

After emQ runs, the process name in the Linux background is beam.smp

[root @ localhost emqx rel - 2.3.11] # netstat tunlp | egrep "beam. The SMP" TCP 0 0 127.0.0.1:11883 0.0.0.0: * LISTEN 31483/beam. SMP TCP 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 31483/beam. SMP TCP 0 0 0.0.0.0:8883 0.0.0.0:* LISTEN 31483/beam. SMP TCP 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 31483/beam. SMP TCP 0 0 0.0.0.0:8084 0.0.0.0:* LISTEN 31483/beam. SMP TCP 0 0 SMP TCP 4 0 0.0.0.0:6369 0.0.0.0:* LISTEN 31483/beam. SMP TCP 0 0 0.0.0.0:18083 SMP TCP 0 0 0.0.0.0:18084 0.0.0.0:* LISTEN 31483/ beam-smp [root@localhost emqx-rel-2.3.11]# kill -9 31483Copy the code

 

 

 

Frequently asked Questions:

Does EMQ have kafka?

A: No, write your own, using the Erlang brod library. github.com/klarna/brod

Or the Erlang Ekaf library. Github.com/helpshift/e…

Here’s a full Kafka project I wrote myself:

Blog.csdn.net/libaineu200…

Reference blog:

(1) github.com/msdevanms/e…

(2) www.cnblogs.com/wunaozai/p/…

EMQ is a complex of EJabberd + ActivemQ + RabbitMQ

www.ejabberd.im/

github.com/TTalkIM

www.rabbitmq.com/

activemq.apache.org/

EMQ hook and session reference ejabberd.

4. The default firewall of CentOS7 is firewall. Disable it

Disable the firewall firewall: sudo systemctl stop firewalld.service

Disable the firewall startup: sudo systemctl disable firewalld.service

Firewall-cmd –state # Check the status

5, if the domain name resolution error occurs

curl#6 – “Could not resolve host: mirrorlist.centos.org; Unknown error”

Then modify /etc/resolv.conf to add

Nameserver 8.8.8.8 nameserver 202.106.0.20

6. Compress commands

The tar – ZCVF emqx – rel – 2.3.11. Tar. Gz emqx – rel – 2.3.11

Unpack the command

The tar – XVF emqx – rel – 2.3.11. Tar. Gz

7. Erlang prints

IO :format(“Value is ~p~n”, [Val]).% Native print

IO :format(“Value is ~w~n”, [Val]).% Binary print

8. Emq common terminal commands

./_rel/emqttd/bin/emqttd console

./_rel/emqttd/bin/emqttd start

./_rel/emqttd/bin/emqttd_ctl status

./_rel/emqttd/bin/emqttd stop

/_rel/emqttd/bin/emqttd_ctl cluster join [email protected]./_rel/emqttd/bin/emqttd_ctl cluster status ./_rel/emqttd/bin/emqttd_ctl cluster leave

9, netstat nalp | grep connection situation of 1883 # to check 1883 port, observe the TCP state diagram netstat nalp | 1883 | grep wc – l # to check 1883 port number of client connections ulimit -n 102400 # Change the maximum number of files in the current process

10, tail -f *. Log # Check log content in real time