From the course: Learning MongoDB
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Replication - MongoDB Tutorial
From the course: Learning MongoDB
Replication
- [Narrator] Throughout this course, we've been running a standalone database, which is fine to get things started, but it's not recommended for production. What if something goes wrong? What if your server crashes or becomes unavailable? While you might be able to fix things quickly, you'll still have some sort of downtime, and downtime isn't good or worse. You might have a disk problem that corrupts your data, and that'd be really bad. Replica sets are MongoDB's way of helping you avoid these problems by running multiple identical copies of your database at once. It does this by having a primary node and multiple secondary notes. The primary copies of all the data to secondaries, and if the primary ever goes away, one of the secondaries automatically takes its place. This also helps for scaling your database. To show this, we're going to want a clean slate, so, I'm actually going to set this up inside a docket…