I have a few questions about MongoDB standalone and Replica sets, I don't really get it.
All these questions I'm asking because recently I was trying to implement transactions and sessions can only start on "replica sets" I don't really get the difference at all.
Replication is the process of synchronizing data across multiple servers. Replication provides redundancy and increases data availability with multiple copies of data on different database servers. Replication protects a database from the loss of a single server. Replication also allows you to recover from hardware failure and service interruptions. With additional copies of the data, you can dedicate one to disaster recovery, reporting, or backup.
- To keep your data safe
- High (24*7) availability of data
- Disaster recovery
- No downtime for maintenance (like backups, index rebuilds, compaction) Read scaling (extra copies to read from)
- Replica set is transparent to the application
The basic implementation to take full advantage of replication specifies you should have at least one primary node with two secondary nodes. So the examples are always with 3 nodes. Not only this if from 3 the Primary node goes down you still have 2 nodes (mongoDB will assign using arbiter rule) and one primary and one secondary for high availability
It does not make sense to have single instance with mongo replication.
Convert a Standalone to a Replica Set . Your existing data will be migrated to all replication instances once they are up and running when converted to replication sets from standalone.