Azure – Communication errors while trying to replicate mongodb

azuredatabase-replicationmongodbreplicationubuntu-14.04

I'm trying to replicate my mongodb database, I've crated 2 VM on my windows azure account.
both of them are Ubuntu 14.04.
I've opened 27017 port on both of them, and installed mongodb latest version.
I started mongo by using

mongod --port 27017 --dbpath /data/datadrive --replSet rs0

on both machines, and added the other member by using

rs.add("INTERNAL IP ADDRESS:27017")

I kept getting an error that I have two primaries, I was reading in one of the forums
that it happened because of the bind_ip configuration in /etc/mongodb.conf
so I changed the bind_ip to other Vm private net ip on both VM's
and while trying to add the server member I've got the following errors.

On the "primary" side:

[rsMgr] not electing self, 100.79.138.73:27017 would veto with 'I don't think reptester1:27017 is electable'
[rsHealthPoll] replset info 100.79.138.73:27017 thinks that we are down
[rsHealthPoll] replset info 100.79.138.73:27017 thinks that we are down

and on the "secondary" side:

[rsHealthPoll] getaddrinfo("reptester1") failed: Name or service not known
[rsHealthPoll] couldn't connect to reptester1:27017: couldn't connect to server reptester1:27017 (0.0.0.0) failed, address resolved to 0.0.0.0
[rsHealthPoll] replset info reptester1:27017 just heartbeated us, but our heartbeat failed: , not changing state
[rsHealthPoll] getaddrinfo("reptester1") failed: Name or service not known

Any ideas what am I doing wrong?

Best Answer

It's DNS. reptester1 isn't resolving. Fix that and you should be all set.

Related Topic