简体   繁体   中英

How to make Read replica on MongoDB Replica in AWS

在此处输入图片说明

Above is my mongodb cross replication in AWS. In our project I've added following connection string mongodb://admin:ayaplus16072019@mongo1.mydatabase.db:27017,mongo2.mydatabase.db:27017,mongo3.mydatabase.db:27017,mongo4.mydatabase.db:27017,arbiter.mydatabase.db:27017/admin?replicaSet=rsadmin as read replica to all secondary including different region. But now, I don't want to make read replica to different region called seoul region but keep syncing with other members, can I remove mongo4.mydatabase.db:27017 from connection string.

I don't want to make read replica to different region called seoul region but keep syncing with other members, can I remove mongo4.mydatabase.db:27017 from connection string.

Replica set members listed in the connection string are used as a seed list in order to connect and discover your replica set configuration. The seed list does not have to contain all members of the replica set, and does not prevent additional members from being discovered via the replica set config .

If you want your replica set member in Seoul to be hidden from client applications, you need to make it hidden and priority 0 . The hidden option will ensure this replica set member is not discoverable, and priority 0 is required since hidden members are not eligible to become primary. It is still possible to connect to a hidden replica set member directly, if needed.

I would also consider making this hidden secondary non-voting and removing the arbiter, which would leave you with 3 voting members in Singapore. An arbiter is only required when you have an odd number of voting members. If your secondary in Seoul is strictly for offsite backup or disaster recovery it does not need to participate in elections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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