简体   繁体   English

Mongo只读同步数据库

[英]Mongo read only sync database

I have a replicaSet of mongo running , I just want to have another read only clone of same replicaSet(slave) ,with all the data in it is in sync with replicaSet(master). 我有一个正在运行的mongo的copysetSet,我只想拥有一个相同copysetSet(slave)的另一个只读克隆,其中的所有数据都与copysetSet(master)同步。 I had come across a solution available here . 我曾经碰到过可用的解决方案在这里 But could not exactly figure out the way it works . 但是无法确切地知道它的工作方式。 Any suggestion or approach to implement the same. 任何实现相同的建议或方法。

If you want to add a further node which will always be read-only, that means you can't allow it to be the Primary . 如果要添加另一个始终为只读的节点,则意味着您不能将其设为Primary To do that, you need to set the member's priority to 0; 为此,您需要将成员的优先级设置为0;否则,将优先级设置为0。 you can also set its votes attribute to 0 too, if you want to make it completely passive in the replica set. 如果要使其在副本集中完全被动,也可以将其投票属性也设置为0。

The documentation describes this method of simulating a master-slave relationship within a replica set . 该文档描述了这种在副本集中模拟主从关系的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM