[SERVER-34060] Intranet & Internet Address in mongodb replica set Created: 22/Mar/18  Updated: 23/Apr/18  Resolved: 23/Mar/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 3.2.4
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: ttnn Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-1889 Support different networks / nics for... Closed
Participants:

 Description   

I have a 2 nodes mongodb replica set in a cloud platform. The two nodes have their own intranet & internet address as follows:
Primary node: intranet 172.17.255.4 internet 39.128.114.219
Secondary node: intranet 172.17.255.6 internet 123.99.24.163
The mongod's listen port 14821 can be telnet in internet.

Then I add two dns records:
172.17.255.4 db2018-3.acmcoder.com
172.17.255.6 db2018-4.acmcoder.com

Now, I use nodejs to connect this replica set.
When the nodejs app using conn string

'mongodb://****:****@172.17.255.4:14821,172.17.255.6:14821/discuss?replicaSet=acmcoder&readPreference=secondary'

is deploy in the same intranet network with mongo server, it can work. But when I start the nodejs app using conn string

'mongodb://****:****@39.128.114.219:14821,123.99.24.163:14821/discuss?replicaSet=acmcoder&readPreference=secondary'

in my office with internet, it cant't work. Because the driver said the secondary address is db2018-4.acmcoder.com. How to fix this problem.
I have a temp way to add a record to the local hosts file in my computer.
123.99.24.163 db2018-4.acmcoder.com
But I think this is the correct way to resolve this problem.

The rs status is:

acmcoder:PRIMARY> rs.status()
{
	"set" : "acmcoder",
	"date" : ISODate("2018-03-22T01:49:17.235Z"),
	"myState" : 1,
	"term" : NumberLong(82),
	"heartbeatIntervalMillis" : NumberLong(2000),
	"members" : [
		{
			"_id" : 42,
			"name" : "db2018-3.acmcoder.com:14821",
			"health" : 1,
			"state" : 1,
			"stateStr" : "PRIMARY",
			"uptime" : 209805,
			"optime" : {
				"ts" : Timestamp(1521683357, 8),
				"t" : NumberLong(82)
			},
			"optimeDate" : ISODate("2018-03-22T01:49:17Z"),
			"electionTime" : Timestamp(1521474805, 1),
			"electionDate" : ISODate("2018-03-19T15:53:25Z"),
			"configVersion" : 117,
			"self" : true
		},
		{
			"_id" : 43,
			"name" : "db2018-4.acmcoder.com:14821",
			"health" : 1,
			"state" : 2,
			"stateStr" : "SECONDARY",
			"uptime" : 207736,
			"optime" : {
				"ts" : Timestamp(1521683355, 18),
				"t" : NumberLong(82)
			},
			"optimeDate" : ISODate("2018-03-22T01:49:15Z"),
			"lastHeartbeat" : ISODate("2018-03-22T01:49:15.476Z"),
			"lastHeartbeatRecv" : ISODate("2018-03-22T01:49:16.562Z"),
			"pingMs" : NumberLong(0),
			"syncingTo" : "db2018-3.acmcoder.com:14821",
			"configVersion" : 117
		}
	],
	"ok" : 1
}



 Comments   
Comment by Spencer Brody (Inactive) [ 23/Apr/18 ]

Dupe of SERVER-1889

Comment by Ramon Fernandez Marina [ 23/Mar/18 ]

Thanks for your report. A similar question was asked before in google groups.

Please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience. A question like this involving more discussion would be best posted on the mongodb-user group. See also our Technical Support page for additional support resources.

Regards,
Ramón.

Generated at Thu Feb 08 04:35:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.