Skip to content

Instantly share code, notes, and snippets.

@supix
Last active December 9, 2017 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save supix/4decc5dabc3077082c0e490b6705009b to your computer and use it in GitHub Desktop.
Save supix/4decc5dabc3077082c0e490b6705009b to your computer and use it in GitHub Desktop.
These two scripts allow to configure a MongoDB replica set in a msdos console
#mkdir -p /data/rs1 /data/rs2 /data/rs3
"c:\Program Files\mongodb\Server\3.2\bin\mongod" --replSet replica_name --dbpath "c:\data\rs1" --port 27017 --oplogSize 64 --smallfiles
"c:\Program Files\mongodb\Server\3.2\bin\mongod" --replSet replica_name --dbpath "c:\data\rs2" --port 27018 --oplogSize 64 --smallfiles
"c:\Program Files\mongodb\Server\3.2\bin\mongod" --replSet replica_name --dbpath "c:\data\rs3" --port 27019 --oplogSize 64 --smallfiles
config = { _id: "replica_name", members:[
{ _id : 0, host : "localhost:27017"},
{ _id : 1, host : "localhost:27018"},
{ _id : 2, host : "localhost:27019"} ]
};
rs.initiate(config);
rs.status();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment