Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 17, 2020 05:08
Show Gist options
  • Save velotiotech/adbd8e5d0d1cba3432742bcb3d062d1f to your computer and use it in GitHub Desktop.
Save velotiotech/adbd8e5d0d1cba3432742bcb3d062d1f 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