I have multiple large mongodb clusters running mongodb 3.4 configured with wiredtiger. I would like to set up standalone instances with just a few DBs from these clusters, all on the same EC2 instance.

What I've done so far is to create snapshots of the disks (DB and journal) on a replica from each of the clusters. I then create EBS volumes from these snapshots and mount them on the same EC2 instance.

My problem is the time the restoration takes; though I want just 5-10% of the original data, I have a long process of chowning the data, followed by a lengthy DB startup of each of the standalone mongodb instances and then dropping the majority of the DBs. This process takes a few hours which I'd like to expedite.

I went with starting from snapshots rather than performing dump+restore because I was hoping it would be quicker.

Given the fact that I want to get rid of the majority of the DBs (so I don't care about corruption related to them), is there a method someone can recommend that will leave me with just the DBs I need?

  • If you need only part of data (and databases), why you don't bring up just one of those shards as a standalone copy? (not as a cluster) – JJussi Jan 2 '18 at 4:44
  • 1
    The better way in AWS is, Take an AMI of the primary server. launch an instance from the AMI, Remove replica set in conf file. Then drop unwanted databases. – Bhuvanesh Jan 2 '18 at 7:34
  • @JJussi the data is sensitive, I need to remove it before using the instances. – David Resnick Jan 2 '18 at 8:11
  • @SQLadmin I think that creating the snapshot is equivalent to making an AMI based on the primary server. I'll still have the extra time of starting up the instance and dropping the DBs. – David Resnick Jan 2 '18 at 8:12
  • 1
    Hmm.. How about bring new empty mongodb node up and then use db.cloneDatabase() or db.cloneCollection(from, collection, query) command to clone there only what you need. – JJussi Jan 2 '18 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.