jessefournier
jessefournier

Reputation: 193

MongoDB - set replication to DocumentDB

We're setting up a local MongoDB cluster - Locally, we'll have one primary and one node, and we want to have another node in AWS. Is it possible to have that node as the DocumentDB service instead of an EC2 instace?

Also, I know I must have an odd number of total nodes, is it possible to first add one node and then add another one? Thanks ahaed.

Upvotes: 1

Views: 1391

Answers (2)

Erik Finnman
Erik Finnman

Reputation: 1677

If you're only trying to replicate the data to DocumentDB, Database Migration Service is a good tool for the job: https://aws.amazon.com/dms/

But like others have said, this will be a separate cluster from your MongodDB setup.

Upvotes: 1

D. SM
D. SM

Reputation: 14520

Also, I know I must have an odd number of total nodes

In a MongoDB replica set, you can have any number of nodes you like. It is possible to have a 2-node replica set, although it's not very practically useful since unavailability of a single node (e.g. a restart for maintenance) would make the whole deployment unavailable for writes. A 4-node replica set is a feasible construction if you wanted an additional replica somewhere (e.g. for geographically close querying from a secondary, or for analytics querying), though if you are simply doing this for redundancy you should probably stick with the standard 3-node configuration and configure proper backups.

Is it possible to first add one node and then add another one?

You can reconfigure a replica set at any time.

Is it possible to have that node as the DocumentDB service instead of an EC2 instace?

Unlikely. DocumentDB is not MongoDB. DocumentDB pretends to be like a MongoDB but it 1) pretends to be an old version of MongoDB, 2) even then many features don't work, and 3) it's not anywhere near the same architecture as MongoDB under the hood. So when you ask a genuine MongoDB database to work with a DocumentDB node, this will probably not work.

This assumes you can even configure DocumentDB in the required manner - I suspect this won't be possible to begin with.

Upvotes: 1

Related Questions