directoryperdb on One Node in an Existing Replica Set

I have an existing MongoDB replica set running on MongoDB 7.0 community, and I want to enable “directoryperdb” on only one node while keeping the other nodes as they are.

My Questions:

Is it possible to enable directoryperdb on just one instance in the replica set without affecting replication?
Will this cause data inconsistency, replication lag, or any other issues?

If not supported, is there any recommended way to migrate to directoryperdb across all nodes in a rolling manner without downtime?

Any guidance or best practices would be greatly appreciated. Thanks!

Hi @Udit_Agarwal1 , welcome to the Community Forums.

Well, it is possible to enable directoryPerDB on just one instance. The big question is that MongoDB needs to rebuild the files inside the new directories, and there is no tool that does this.

Whenever I needed to do this conversion:

  • it was by stopping MongoDB
  • removing the files from the data directory
  • starting MongoDB with the directoryPerDB: true option and
  • waiting for the Initial Sync.

If you have 3 nodes in the Replica Set, this will not impact the applications, but it may cause some overhead during the process. Therefore, you can do a rolling manner until you complete the three nodes.

Best,

Leandro Domingues