Created
July 18, 2019 06:01
-
-
Save efossas/2716eac945e2db5d3a594415e293f352 to your computer and use it in GitHub Desktop.
Mongo Replica Set Script
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
function initReplicaSet() { | |
return rs.initiate({ | |
"_id": "appReplicaSet", | |
"members": [ | |
{ | |
"_id": 0, | |
"host": "mongo_1:27017" | |
}, | |
{ | |
"_id": 1, | |
"host": "mongo_2:27017" | |
}, | |
{ | |
"_id": 2, | |
"host": "mongo_3:27017" | |
} | |
] | |
}) | |
} | |
while (initReplicaSet().ok === 0) sleep(1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment