I have set up docker and created four containers (each having single mongodb instance installed with authetication enabled) to enable mongodb replication with arbiter. I have also expose mongodb's 27017 port to host machine so that outer application should able to connect it but I am not able to connect with my JAVA Spring Application from Eclipse.
Following is mongo uri I used:
mongodb://username:[email protected]:18088,192.168.1.102:18089,192.168.1.102:18099/?authSource=dbName;replicaSet=rs0;readPreference=secondaryPreferred;authMechanism=SCRAM-SHA-1;waitQueueMultiple=100
Exception"Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate$1@739c3a21. Client view of cluster state is {type=REPLICA_SET, servers=[{address=mongo3:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo3}, caused by {java.net.UnknownHostException: mongo3}}, {address=mongo2:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo2}, caused by {java.net.UnknownHostException: mongo2}}, {address=mongo1:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo1}, caused by {java.net.UnknownHostException: mongo1}}, {address=mongorb:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongorb}, caused by {java.net.UnknownHostException: mongorb}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate$1@739c3a21. Client view of cluster state is {type=REPLICA_SET, servers=[{address=mongo3:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo3}, caused by {java.net.UnknownHostException: mongo3}}, {address=mongo2:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo2}, caused by {java.net.UnknownHostException: mongo2}}, {address=mongo1:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo1}, caused by {java.net.UnknownHostException: mongo1}}, {address=mongorb:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongorb}, caused by {java.net.UnknownHostException: mongorb}}]"