Skip to content

Instantly share code, notes, and snippets.

@iToto
Created July 29, 2014 02:44
Show Gist options
  • Save iToto/650a485cda92372f1523 to your computer and use it in GitHub Desktop.
Save iToto/650a485cda92372f1523 to your computer and use it in GitHub Desktop.
Bash script to create a mongo Replica Set
#!/bin/bash
# This script will start three Mongo nodes as a replica set.
# NB: Be sure to create the log files and give write perms to the user
# One
mongod --port 27017 --dbpath /srv/mongodb/rs0-0 --replSet rs0 --smallfiles --oplogSize 128 --fork --logpath /var/log/mongo/27017
# Two
mongod --port 27018 --dbpath /srv/mongodb/rs0-1 --replSet rs1 --smallfiles --oplogSize 128 --fork --logpath /var/log/mongo/27018
# Three
mongod --port 27019 --dbpath /srv/mongodb/rs0-2 --replSet rs2 --smallfiles --oplogSize 128 --fork --logpath /var/log/mongo/27019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment