how to keep read and write separate mongo replicat set
bin>mongod --dbpath "xx" --port 27017 --replSet replset/127.0.0.1:27018
bin>mongod --dbpath "yy" --port 27018 --replSet replset/127.0.0.1:27017
bin>mongod --dbpath "zz" --port 27019 --replSet re开发者_开发技巧plset/127.0.0.1:27017
client driver how use to separate read/write? mongodb://host1,host2,host3/
By default, MongoDB always reads from and writes to the primary of a replica set.
Each driver provides a slaveOkay
option that allows you to read from something other than the primary.
You will need to look at the documentation for your specific language to see how slaveOkay
is used.
精彩评论