mongodump cannot be used to seed a secondary.

A file system snapsnapshot and copying the files to the target host should be faster. And with a good file sync program the copy should be able to be stopped and resumed if the IO or bandwidth requirements impact the production load.

If an underlying storage does not support it consider using a LVM on the host.

I have another method but I don’t have a full writeup for it. Nor is it fully tested and is definitely not official.

A couple of prerequisites:

  • Datapath must be on xfs. It should be per Production Notes.
  • XFS volume must have reflinks enabled. xfs_info can show this(reflink=1).
  • Oplog mush have enough headroom to allow for the duration of the copy to the taget host.
  • XFS volume must have enough free space. 2x Oplog size plus some margin.

This method used XFS reflink functionality to create a copy of all the files similar to a LVM snapshot.

  1. Stop a secondary or Quiesce a secondary by using db.fsynlock().
  2. Copy all files in data directory of this secondary using cp option --reflink=always to another directory(sync directory) on the same filesystem.
  3. Start the secondary or db.fsyncunlock().
  4. Copy the file from the sync directory to the member that need seeding.
  5. Delete the files from the sync directory.
1 Like