Reputation: 1
I am trying to create an EMQ X bridge setup (MQTT bridging) using only docker-compose. As a reference i am looking at the official docs. The use case i have in my mind is bridging EMQ X Edge (emqx-edge
) to EMQ X (emqx
), and then when a message is published to emqx-edge
it will be forwarded to emqx
. So far, i have created the two brokers and a network, so they can communicate(poc-bridge).
The problem is : when a message is published to a topic(e.g sensor1/#
) to emqx-edge
broker, it never arrived to emqx
broker. I can not figure what is going wrong..
Bellow is the docker-compose i have so far.
version: '3.3'
networks:
poc-bridge:
external: true
services:
mqtt-edge:
image: emqx/emqx-edge:latest
container_name: edge-broker
restart: always
environment:
- EMQX_LOADED_PLUGINS= "emqx_bridge_mqtt"
- EMQX_ADMIN_PASSWORD=brokerpw1
- EMQX_BRIDGE__MQTT__AWS__ADDRESS=172.26.0.2:1883 #ip:port of mqtt-cloud
- EMQX_BRIDGE__MQTT__AWS__PROTO_VER=mqttv3
- EMQX_BRIDGE__MQTT__AWS__BRIDGE_MODE=true
- EMQX_BRIDGE__MQTT__AWS__CLEAN_START=true
- EMQX_BRIDGE__MQTT__AWS__USERNAME=user
- EMQX_BRIDGE__MQTT__AWS__PASSWORD=passw
- EMQX_BRIDGE__MQTT__AWS__CLIENTID=bridge_aws
- EMQX_BRIDGE__MQTT__AWS__KEEPALIVE=10s
- EMQX_BRIDGE__MQTT__AWS__FORWARDS=sensor1/#
networks:
- poc-bridge
ports:
- 18083:18083
- 1883:1883
- 8883:8883
- 8083:8083
depends_on:
- mqtt-cloud
mqtt-cloud:
image: emqx/emqx:latest
container_name: cloud-broker
restart: always
networks:
- poc-bridge
ports:
- 51883:1883
- 58883:8883
- 58083:8083
Upvotes: 0
Views: 3581
Reputation: 1
Problem solved. I was missing some more configurations... Bellow is the docker-compose yaml for bridging emqx-edge to emqx.
version: '3.3'
networks:
poc-bridge:
external: true
services:
mqtt-edge:
image: emqx/emqx-edge:latest
container_name: edge-broker
restart: always
environment:
- EMQX_LOADED_PLUGINS="emqx_bridge_mqtt,emqx_recon,emqx_retainer,emqx_management,emqx_dashboard"
- EMQX_ADMIN_PASSWORD=brokerpw1
- EMQX_BRIDGE__MQTT__AWS__START_TYPE=auto
- EMQX_BRIDGE__MQTT__AWS__ADDRESS=172.26.0.2:1883 # docker-ip:port of mqtt-cloud
- EMQX_BRIDGE__MQTT__AWS__PROTO_VER=mqttv3
- EMQX_BRIDGE__MQTT__AWS__BRIDGE_MODE=true
- EMQX_BRIDGE__MQTT__AWS__CLEAN_START=true
- EMQX_BRIDGE__MQTT__AWS__USERNAME=user
- EMQX_BRIDGE__MQTT__AWS__PASSWORD=passw
- EMQX_BRIDGE__MQTT__AWS__CLIENTID=bridge_aws
- EMQX_BRIDGE__MQTT__AWS__KEEPALIVE=60s
- EMQX_BRIDGE__MQTT__AWS__FORWARD_MOUNTPOINT=bridge/aws/test/
- EMQX_BRIDGE__MQTT__AWS__FORWARDS=atlas/#
#- EMQX_BRIDGE__MQTT__AWS__SUBSCRIPTION__1__TOPIC=atlas/#
#- EMQX_BRIDGE__MQTT__AWS__SUBSCRIPTION__1__QOS=1
networks:
- poc-bridge
ports:
- 18083:18083
- 1883:1883
- 8883:8883
- 8083:8083
depends_on:
- mqtt-cloud
mqtt-cloud:
image: emqx/emqx:latest
container_name: cloud-broker
restart: always
environment:
- EMQX_LOADED_PLUGINS= "emqx_bridge_mqtt"
networks:
- poc-bridge
ports:
- 51883:1883
- 58883:8883
- 58083:8083
Upvotes: 0