mongodb replica set
BennyThink opened this issue · 0 comments
BennyThink commented
command: --replSet rs0
rs.initiate({
_id: "rs0",
members: [{
_id: 0,
host: "mongo1:27017"
},
{
_id: 1,
host: "mongo2:27017"
}]
})
// 优先级
cfg = rs.conf()
cfg.members[0].priority = 0.5
cfg.members[1].priority = 0.5
cfg.members[2].priority = 1
rs.reconfig(cfg)