Last active
December 9, 2017 14:34
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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