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 管理控制檯端口
注意
集羣節點必須在同一個網段,否則添加節點會錯誤
不同節點之間訪問需要在防火牆開啓端口