开发者

how to keep read and write separate mongo replicat set

开发者 https://www.devze.com 2023-04-01 16:57 出处:网络
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 "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.

0

精彩评论

暂无评论...
验证码 换一张
取 消