Mokkito horizontal scaling

I have one load balancer ie aws elb all pub / sub will go through this bosom two mosquito brokers A and a Moscow broker B under the elbow one Moskvich broker to synchronize the topic between these two brokers (mosquitto.broker.sync)

TRY ONE

thus the configuration for the mosquitto broker that synchronizes threads between node A and B looks the same

mosquitto.broker.sync: ## connection mosquitto-bridge try_private false address mosquitto.broker.A:1883 mosquitto.broker.B:1883 start_type automatic round_robin true notifications true topic # both 2 "" "" 

But this does not work, it is only a connection to mosquitto.broker.A and not a connection to mosquitto.broker.B.

TRY TWO h2>

cancel everything first try

so I tried it differently removed the entire bridge configuration from mosquitto.broker.sync (just to avoid loops)

and added this configuration to nodes

mosquitto.broker.A: ##

 connection mosquitto-bridge try_private false address mosquitto.broker.sync:1883 start_type automatic round_robin true notifications true topic # both 2 "" "" 

mosquitto.broker.B: ##

 connection mosquitto-bridge try_private false address mosquitto.broker.sync:1883 start_type automatic round_robin true notifications true topic # both 2 "" "" 

mosquitto.broker.sync: ##

 #connection mosquitto-bridge #try_private false #address mosquitto.broker.A:1883 mosquitto.broker.B:1883 #start_type automatic #round_robin true #notifications true #topic # both 2 "" "" 

But in this case, the node on which I am sending the message is duplicated above it

+3
source share
1 answer

For a fist attempt, the problem is that the address field is a list of brokers to which you should try to connect in order, and not a list of simultaneous brokers connections.

How this list is interpreted depends on the round_robin parameter.

If set to true , then the broker will connect to the first one in the list, and when the connection drops, he will try the next one in the list, moving the list through each reconnection.

If set to false , it will connect to the first and consider this as the preferred connection. When the connection fails, he will try to connect again, if he fails, he will move down the list, but periodically try to reconnect to the fist in the list.

To solve your problem, try something like this:

mosquitto.broker.A

 connection sync-a try_private false address mosquitto.broker.sync:1883 notifications true topic # out 2 "" A/ topic # in 2 "" B/ 

mosquitto.broker.B

 connection sync-b try_private false address mosquitto.broker.sync:1883 notifications true topic # out 2 "" B/ topic # in 2 "" A/ 

And leave the synchronizer as it is.

Prefixes are used here so as not to create loops. It also means that you can keep track of which broker is doing what is on the synchronization machine, since all topics are prefixed with the machine from which they came.

+3
source

All Articles