EMQ服务器集群

EMQ集群

下载

https://www.emqx.io/downloads/broker/?osType=Linux

这里下载: emqx-centos6-v4.0.7.zip

单个节点

启动,关闭,查看状态,删除

1.解压程序包

unzip emqx-centos6-v4.0.7.zip

2.启动 EMQ X Broker

emqx/bin/emqx start

EMQ X Broker v4.0.7 is started successfully!

3.查看单点状态

emqx/bin/emqx_ctl status

Node '[email protected]' is started
emqx 4.0.7 is running

4.停止 EMQ X Broker

emqx/bin/emqx stop

ok

5.卸载 EMQ X Broker

直接删除 EMQ X 目录即可

集群部署

使用手动添加集群方式部署

1.编辑每个节点的配置文件

vi emqx/etc/emqx.conf

确认集群方式:

cluster.discovery = manual

修改节点名称:

node.name = [email protected]

重启各个节点:

注意

重启不要使用restart命令,先使用stop,在使用start。

2.添加节点

emqx/bin/emqx_ctl cluster join [email protected]

=CRITICAL REPORT==== 15-May-2020::16:10:37.283673 ===
[EMQ X] emqx shutdown for join
Join the cluster successfully.
Cluster status: #{running_nodes => ['[email protected]','[email protected]'],
                  stopped_nodes => []}

3.查看集群状态

emqx/bin/emqx_ctl cluster status

Cluster status: #{running_nodes => ['[email protected]','[email protected]'],
                  stopped_nodes => []}

4.移除节点

当前节点主动退出集群

emqx/bin/emqx_ctl cluster leave

在其他节点移除

emqx/bin/emqx_ctl cluster remove [email protected]

端口说明

  • 1883: MQTT 协议端口
  • 8883: MQTT/SSL 端口
  • 8083: MQTT/WebSocket 端口
  • 8080: HTTP API 端口
  • 18083: Dashboard 管理控制台端口

注意

集群节点必须在同一个网段,否则添加节点会错误

不同节点之间访问需要在防火墙开启端口

官网更多配置及使用说明

来自网友

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章