Skip to content

Instantly share code, notes, and snippets.

@yupadhyay
Last active August 29, 2015 14:11
Show Gist options
  • Save yupadhyay/6b172ff9cf52a11fc8ef to your computer and use it in GitHub Desktop.
Save yupadhyay/6b172ff9cf52a11fc8ef to your computer and use it in GitHub Desktop.
cd <Your Mongo bin Location>
# You can also configure port using configuration file
./mongo --port <PORT>
rs.initiate()
# Check the conf that it is not part of replica set yet
rs.conf()
#This is your second Mongo Instance, Make sure that your other Mongo Instance is already set up
rs.add("<HOST>:<PORT>")
#This is your Third Mongo Instance (You need to have odd number of instances for election to work)
rs.add("<HOST>:<PORT>")
# If you do not have space or do not want additonal instance then you can add arbitor
# Arbitor is another Mongo Instance which do not store data but take part in election process one one mongo is down
# You can add arbitor using following command
# rs.addArb("<HOST>:<PORT>")
# Check Conf to make sure that everything is right
rs.conf()
# Check Status of replication
rs.status()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment