0

The instances are new with no data and were created in AWS Marketplace using a Parse server powered by Bitnami on Ubuntu 14.04.

I tried to add a node using rs.add() but got this error:

rs0:PRIMARY> rs.add( "172.31.39.86:27017" )
{
    "ok" : 0,
    "errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: ip-172-31-44-97:27017; the following nodes did not respond affirmatively: 172.31.39.86:27017 failed with Failed attempt to connect to 172.31.39.86:27017; couldn't connect to server 172.31.39.86:27017 (172.31.39.86), connection attempt failed",
    "code" : 74
}

The PrivateIP of the instance I'm trying to add to the ReplicaSet "rs0" is 172.31.39.86 and the PrivateIP of the instance which is currently PRIMARY is 172.31.44.97.

The steps I did are describe as follow:

  • SSH the instances (into both instances each in a different terminal)

    ssh ubuntu@InstancePublicIP -i KeyFileName

  • Shutdown MongoDB (in both instances)

    sudo /opt/bitnami/ctlscript.sh stop

  • Edit the mongodb.conf file by adding replSet = rs0 (in both instances)

    sudo nano /home/bitnami/stack/mongodb/mongodb.conf

Looking like this:

dbpath=/opt/bitnami/mongodb/data/db
logpath=/opt/bitnami/mongodb/log/mongodb.log
logappend=true
bind_ip = 0.0.0.0
port = 27017
auth = true
setParameter = enableLocalhostAuthBypass=0
unixSocketPrefix=/opt/bitnami/mongodb/tmp
fork = true
setParameter = enableLocalhostAuthBypass=0
replSet = rs0
filePermissions = 0766
  • Restart MongoDB (in both instances)

    sudo /opt/bitnami/ctlscript.sh restart

  • Access to MongoDB (in one of the instances "172.31.44.97")

    mongo admin --username root --password fromSystemLog

  • Start the Replication Set (in the MongoDB shell of one of the instances "172.31.44.97")

    rs.initiate()

  • Add a node to the PRIMARY (in the MongoDB shell of one of the instances "172.31.44.97")

    rs.add( "172.31.39.86" )

Isaac.S
  • 1
  • 2

1 Answers1

0

That error message comes when primary node cannot connect that secondary during rs.add -process. Reason to that is normally FIREWALL at destination, what prevents traffic to any other port than SSH.

If you go to command line of your (current PRIMARY) mongodb node and give command mongo --host 172.31.39.86:27017 the other mongo node should answer. If not, then connection to that node is not working OR node is not working.

JJussi
  • 1,540
  • 12
  • 12