0

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?

Dor
  • 43
  • 5

1 Answers1

0

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

Nathan C
  • 15,059
  • 4
  • 43
  • 62
  • Thnks, BY changing the primary host, they connected one each other. $conf = rs.conf() $conf.members[0].host = "mongo.cloudapp.net:27017" rs.reconfig($conf) – Dor Sep 11 '14 at 11:26