Not Able to Configure Replication

Hi Team,

I am trying to configure replication with three EC2 instance . While configuring the replication I gave the private IP’s of three instances in mongod.conf file but while starting the service getting below error.

> {"t":{"$date":"2024-05-17T02:31:17.878+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"xx.xx.xx.xx,xx.xx.xx.xx,xx.xx.xx.xx","port":27017},"processManagement":{"timeZoneInfo":"/usr/share/zoneinfo"},"replication":{"replSetName":"rs0"},"storage":{"dbPath":"/var/lib/mongo"},"systemLog":{"destination":"file","logAppend":true,"path":"/var/log/mongodb/mongod.log"}}}}
> {"t":{"$date":"2024-05-17T02:31:17.879+00:00"},"s":"E",  "c":"CONTROL",  "id":20568,   "ctx":"initandlisten","msg":"Error setting up listener","attr":{"error":{"code":9001,"codeName":"SocketException","errmsg":"setup bind :: caused by :: Cannot assign requested address"}}}

Can anyone help me to fix this.

Thnaks,
Debasis

This is not possible, you only include IP addresses of network interfaces on the local machine where mongod is running. You can not bind IP’s of different hosts/instances.

1 Like