使用的5.0.26
使用的是官方网站上的docker-compose.yml
两个容器是一个网段,页面也正常显示2个节点
但是无法用NGINX做负载均衡
请问在配置NGINX下emqx的IP是容器内的IP吗? NGINX需要和emqx在一个网段吗?
ip为内网地址 端口做了映射1883和1884
version: ‘3’
services:
emqx1:
image: emqx:5.0.26
container_name: emqx1
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
ports:
- 1883:1883
- 8083:8083
- 8084:8084
- 8883:8883
- 18083:18083
# volumes:
# - $PWD/emqx1_data:/opt/emqx/data
emqx2:
image: emqx:5.0.26
container_name: emqx2
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
ports:
- 1884:1883
# volumes:
# - $PWD/emqx2_data:/opt/emqx/data
networks:
emqx-bridge:
driver: bridge