Created
June 17, 2020 05:08
-
-
Save velotiotech/adbd8e5d0d1cba3432742bcb3d062d1f to your computer and use it in GitHub Desktop.
Velotio - HashiCorp Consul Part 2 - MongoDB Replica Set Configuration
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
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