Summary
In this chapter, you learned how to move a MongoDB instance to a new server without downtime. First of all, you learned that the standalone mongod
instance is not highly available. So, while migrating, you might be faced with a brief outage.
In the first part of this chapter, you learned how to migrate a replica set using the replication feature of MongoDB. This approach has no downtime and is simple and straightforward since replication moves the database completely.
Also, you learned that the only concern for this method is that clients cannot perform write operations during election, and we introduced a hack to perform these operations at an interval. Meanwhile, we learned how to route read operations during election using the slaveOk
function.
Then, you learned how to convert a standalone mongod
instance to a replica set and follow the same approach to migrate a replica set for the standalone instance. Furthermore, we introduced a way to move the database by duplicating the dbpath...