[JAVA-643] The driver tried to connect to remote server using internal ip Created: 18/Sep/12  Updated: 25/Jun/13  Resolved: 19/Sep/12

Status: Closed
Project: Java Driver
Component/s: API, Cluster Management
Affects Version/s: 2.9.0, 2.9.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: roger xia Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

aws ec2



 Description   

We are using mongo replica set on ec2, we try to use new Mongo(seeds) and external ip list as server address to get a Mongo instance from remote ec2 server, when tried to update a collection, we met with a problem that the driver failed to connect to mongo as the server hostname (external ip) changed to ec2 internal ip, so connection timeout and failed.

Driver 2.7.3 is OK, Driver 2.8.0 can not find the master.



 Comments   
Comment by roger xia [ 19/Sep/12 ]

Thanks.

Comment by Scott Hernandez (Inactive) [ 18/Sep/12 ]

Don't use IP addresses at all. Use aliases or cnames that resolve correctly
in both places. As long as everything is in aws then the non-internal
amazon names work fine for everyone. Please read the amazon mongodb white
paper for an example.

Comment by roger xia [ 18/Sep/12 ]

Scott, thanks for your reply, my idea is amazon suggest users to use internal IP address across internal servers, so we configure the replica set using internal IP addresses, but in the java driver, we use external IP address list to connect, we know version 2.7.3 works. So any other suggestions you can give us rather than change the replica set configure IP addresses to external IP and grant permission on port for each of them.

Comment by Scott Hernandez (Inactive) [ 18/Sep/12 ]

All drivers use the addresses configured in the replica set configuration. The seed addresses are just used to get the configuration from the set.

Configuring external aws addresses is how you want to do it as they resolve to internal IP addresses internally.

Generated at Thu Feb 08 08:52:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.