Created
August 30, 2013 13:50
-
-
Save rynr/6390047 to your computer and use it in GitHub Desktop.
Create a mongo-rs for testing
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
i=0 | |
name=rs01 | |
while [ $i -lt 3 ] | |
do let i=i+1 | |
echo "Starting mongodb $i at Port 2222$i" | |
mkdir db$i | |
mongod --port 2222$i --fork --dbpath db$i --syslog --replSet $name | |
if [ $i -eq 1 ] | |
then echo "rs.initiate({_id: \"$name\", members: [{_id: 0, host: \"localhost:2222$i\"}]})" | mongo localhost:22221 | |
else echo "rs.add(\"localhost:2222$i\")" | mongo localhost:22221 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment