简体   繁体   中英

How to sync multiple MongoDB instances?

I have a service on a remote server (server1) that uses a MongoDB database. Now i want to copy that service and the database to a second server (server2) to have a failsafe in case server1 has any problems.

How would i go about synchronizing the database so it's always the same on both servers and so that when server1 goes up after a problem it migrates any changes made to server2's database to it's own?

You can create a replica set of your Server 1. MongoDB provides this feature.

There is an extensive explanation on MongoDB Replication in Mongo's Official Documentation.

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