Created
October 23, 2019 02:35
-
-
Save lucasltv/5d09554e835e1697d3eefcc3f0cf70c0 to your computer and use it in GitHub Desktop.
Start MONGO local DEV in replica set
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
#MONGOD REPLICASET: https://docs.mongodb.com/manual/tutorial/deploy-replica-set-for-testing/ | |
export MONGO_DIR=~/mongodb | |
mongod --replSet rs0 --port 27017 --bind_ip localhost --dbpath ${MONGO_DIR}/rs0-1 --logpath "${MONGO_DIR}/rs0-1.log" --smallfiles --oplogSize 128 --fork & | |
mongod --replSet rs0 --port 27018 --bind_ip localhost --dbpath ${MONGO_DIR}/rs0-2 --logpath "${MONGO_DIR}/rs0-2.log" --smallfiles --oplogSize 128 --fork & | |
mongod --replSet rs0 --port 27019 --bind_ip localhost --dbpath ${MONGO_DIR}/rs0-3 --logpath "${MONGO_DIR}/rs0-3.log" --smallfiles --oplogSize 128 --fork | |
# Login via mongo shell: | |
# rsconf = { | |
# _id: "rs0", | |
# members: [ | |
# { | |
# _id: 0, | |
# host: "localhost:27017" | |
# }, | |
# { | |
# _id: 1, | |
# host: "localhost:27018" | |
# }, | |
# { | |
# _id: 2, | |
# host: "localhost:27019" | |
# } | |
# ] | |
# } | |
# rs.initiate( rsconf ) | |
# rs.conf() | |
# rs.status() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment