Skip to content

Instantly share code, notes, and snippets.

@pranavcode
Created March 30, 2019 15:24
Show Gist options
  • Save pranavcode/4baf2bceed0c17af7136951a5dc89b03 to your computer and use it in GitHub Desktop.
Save pranavcode/4baf2bceed0c17af7136951a5dc89b03 to your computer and use it in GitHub Desktop.
Velotio - HashiCorp Consul Part 2 - MongoDB Replica Set Configuration
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