Book Image

MongoDB High Availability

By : Afshin Mehrabani
Book Image

MongoDB High Availability

By: Afshin Mehrabani

Overview of this book

Table of Contents (17 chapters)
MongoDB High Availability
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Migrating a replica set in action


For the first part of the migration, we are going to migrate a replica set. In this section, we will learn how to add a new node to the replica set and wait for the synchronization process. Then, we remove the old node and make sure that the migration has been completed successfully.

Explaining the migration process

In this scenario, we have a replica set with one primary, one secondary, and one arbiter node. The following diagram shows the replica set and its members:

Then, we will add a new node to the existing replica set and remove the current primary node.

In this part, a new secondary node synchronizes its oplog with the primary node in a background process. After completing synchronization, you can safely remove the primary node and wait for the replica set to choose the new primary node. This is the election phase.

The following diagram shows the election procedure:

The current replica set has three members. These include one primary node, one secondary...