0

When I have a running MongoDB instance with some data and requests against it, can I start a second instance on another machine, register it as another node in the first instance and all the data is copied to the second node while changes on the first node in the meantime are also mirrored to the second instance? Is that possible?

The context is: I have a single machine deployment with an application and mongodb running on the same instance (Amazon EC2). Its a low budget deployment but I try to have as few downtime as possible. I'd like to change the ec2 instance every week and for that I'd need some sort of mirroring. Is that possible?

1

You can replicate data from one server to others using Replication feature in MongoDB.

The replica set ensures high availability and redundancy of you mongodb data in case if node failure. In your case, you can create a replica set of 3 nodes (PRIMARY, SECONDARY, ARBITER). When one of the server goes down, Secondary would be promoted as PRIMARY which ensures high availability of MongoDB data.

It is always recommended to have at least 3 members in replica set.

You can find detailed document here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.