Created
March 30, 2019 15:24
-
-
Save pranavcode/4baf2bceed0c17af7136951a5dc89b03 to your computer and use it in GitHub Desktop.
Velotio - HashiCorp Consul Part 2 - MongoDB Replica Set Configuration
This file contains hidden or 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
var config = { | |
_id: "consuldemo", | |
version: 1, | |
members: [{ | |
_id: 0, | |
host: "mongo_1:27017", | |
}, { | |
_id: 1, | |
host: "mongo_2:27017", | |
}, { | |
_id: 2, | |
host: "mongo_3:27017", | |
}], | |
settings: { | |
chainingAllowed: true | |
} | |
}; | |
rs.initiate(config, { force: true }); | |
rs.slaveOk(); | |
db.getMongo().setReadPref("nearest"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment