配置docker-compose.yml
官网↓
[安装 | EMQX 5.0 文档](安装 | EMQX 5.0 文档)
docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| version: '3'
services: emqx1: image: emqx/emqx:5.0.4 container_name: emqx1 ports: - 1883:1883 - 8083:8083 - 4369:4369 - 18083:18083 environment: - "EMQX_NODE_NAME=emqx@node1.emqx.io" - "EMQX_CLUSTER__DISCOVERY_STRATEGY=static" - "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io,emqx@node2.emqx.io]" healthcheck: test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"] interval: 5s timeout: 25s retries: 5 networks: emqx-bridge: aliases: - node1.emqx.io
emqx2: image: emqx/emqx:5.0.4 ports: - 1884:1883 - 8084:8083 - 4370:4369 - 18084:18083 environment: - "EMQX_NODE_NAME=emqx@node2.emqx.io" - "EMQX_CLUSTER__DISCOVERY_STRATEGY=static" - "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io,emqx@node2.emqx.io]" healthcheck: test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"] interval: 5s timeout: 25s retries: 5 networks: emqx-bridge: aliases: - node2.emqx.io
networks: emqx-bridge: driver: bridge
|
端口说明:(MQTT 服务器搭建:EMQX 安装指南和常见问题 | EMQ)[MQTT 服务器搭建:EMQX 安装指南和常见问题 | EMQ]
运行,查看节点
1、在compose根目录下运行
2、检验
1 2
| $ docker exec -it emqx1 sh -c "emqx_ctl cluster status"
|
3、查看运行节点
进入web管理页面输入网址ip+188083,默认用户名admin默认密码public。