eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.63k stars 2.33k forks source link

Mosquitto mqtt broker getting diconnected due to same clienId for more than one mosquitto #2892

Open rahulpandey-98 opened 9 months ago

rahulpandey-98 commented 9 months ago

I have made a template for mosquitto mqtt broker to connect to AWS IoT using the information provided on https://aws.amazon.com/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/

I have created a template to launch mosquitto instances through autoscaling. When two instances are created, one of the instance getting disconnected automatically. I am assuming the reason to be issue with client_id. As client_id is same for both the instances, so while using more than instance with same client_id, one of the mosquitto broker is getting disconnected.

I have following queries: **1. How to configure client_id dynamically so that for each instance launched through autoscaling have a distinct client_id?

  1. If reason for disconnecting is something else then please let me know.**
ralight commented 9 months ago

You could try leaving the bridge client id unset, then it would be decided by the remote broker.

NorbertHeusser commented 9 months ago

Not sure, if AWS IoT does allow connections without a clientid. If AWS IoT does require a clientid you would need to generate one in your autoscaling script (e.g generate a UUID).