简体   繁体   中英

Bridging an MQTT broker to 2 remote MQTT brokers simultaneously

We have many local gateways installed at different premises. These gateways will host an MQTT broker for connecting all the local services. Then it is required that the local MQTT broker sends this data to two remote MQTT brokers (each hosted with a different party). I have read the documentation on Mosquitto and VerneMQ brokers and I see that they only allow one remote server to be bridged at a time.

Is there another (open source) broker which provides such functionality? If not how can we achieve this?

You can declare are many bridges as you want with mosquitto.

From the mosquitto.conf man page:

Configuring Bridges

Multiple bridges (connections to other brokers) can be configured using the following variables.

You just have multiple blocks starting with connection

connection test-mosquitto-org
address test.mosquitto.org
cleansession true
topic clients/total in 0 test/mosquitto/org $SYS/broker/

connection foo.broker.org
address 192.168.1.1
topic # both 0

Thanks hardillb. Also in my case I used clients ids, obviously they need to be unique per bridge block:

eg

connection solace.cloud
address <mqtt address>:<port>
remote_username <username>
remote_password <password>
clientid Alpha
try_private false
start_type automatic
topic Nasdaq/ out 0 b1/ ""
topic Nasdaq/ in 0 "" b2/

connection cloudmqtt
cleansession true
address postman.cloudmqtt.com:<port>
remote_username <username>
remote_password <password>
clientid Beta
try_private true
start_type automatic
topic Nasdaq/# out 0
topic Nasdaq/# in 0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM