0

我正在尝试仅使用 docker-compose 创建 EMQ X 桥接设置(MQTT 桥接)。作为参考,我正在查看官方文档。我想到的用例是将EMQ X Edge ( emqx-edge) 桥接到 EMQ X( emqx),然后当消息发布到它时,emqx-edge它会被转发到emqx。到目前为止,我已经创建了两个代理和一个网络,因此它们可以通信(poc-bridge)。

问题是:当一条消息发布到一个主题(例如sensor1/#)给emqx-edge代理时,它永远不会到达emqx代理。我不知道出了什么问题..

Bellow 是我目前拥有的 docker-compose。

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
4

1 回答 1

0

问题解决了。我错过了更多配置... Bellow 是用于将 emqx-edge 桥接到 emqx 的 docker-compose yaml。

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
于 2021-08-04T16:22:22.527 回答