0

I am running Mongodb-3.4x version in a Replica set environment (in all 3 different systems on AWS) i.e. One Primary, One secondary (replica) and an arbiter.

Issue that I am seeing is for some reason; the Primary node is running on "mmapv1" but the Replica (secondary node) is running on "wiredTiger" storage engine.

Now, how can I change Primary to use "WiredTiger" storage engine instead of "MMAPv1" ?

Any help/suggestion in this case would be much appreciated.

Thanks

1 Answer 1

0

Since WiredTiger is the default storage engine in MongoDB 3.2+, I'd guess that your deployment was upgraded from an earlier version of MongoDB where MMAPv1 was the default (and in most cases, only) storage engine. Upgrading will not change the storage engine for an existing dbPath.

To change storage engines you will need to resync the data for that replica set member. There are a few possible approaches, but in either case I would recommend taking a full backup as a precaution before continuing.

Replace the current primary

Since you have a Primary-Secondary-Arbiter configuration, you may want to maintain data redundancy while adding another member running WiredTiger. Adding a new replica set member with default configuration also reduces some effort in determining if any existing configuration parameters are MMAPv1-specific.

  • Provision a new host and MongoDB 3.4 replica set member. Ideally you should be using the same 3.4.x version for all replica set members and this should also be the latest 3.4.x (currently 3.4.21).
  • Configure appropriate dbPath, replication and security options for mongod.
  • Add this member to the replica set as hidden & non-voting (or alternatively, replace your arbiter with this member). Since you already have 3 voting members in your replica set, you do not want to change the total votes to 4.
  • This new member will perform initial sync and use the default storage engine (WiredTiger)
  • Once initial sync has completed, reconfigure your replica set to change this new member to non-hidden and voting, and remove the former primary
  • Shutdown and retire the former primary.

Upgrade the current primary

If provisioning a new replica set member isn't a reasonable option, you can instead upgrade the existing replica set member. An important caveat for your Primary-Secondary-Arbiter configuration is that you will only have one full copy of your data (outside of backups) until the initial sync completes.

  • Check your MongoDB server configuration and comment out or remove any MMAPv1-specific storage options. For example, storage.engine should not be explicitly set.
  • Shutdown the current primary.
  • Move (or remove) the contents of the dbPath.
  • Restart the primary to perform initial sync.

This procedure is more generally described in the MongoDB manual: Change Replica Set to WiredTiger.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .