Meteor-CollectionFS icon indicating copy to clipboard operation
Meteor-CollectionFS copied to clipboard

s3: proper way to mongorestore

Open zaklampert opened this issue 9 years ago • 4 comments

Everytime I run a mongorestore, my s3 bucket reverts back to some earlier state - not all files are deleted, but most are.

What's the proper way to restore a db backup without overwriting all the s3 data? Should I exclude some collection?

zaklampert avatar Jun 02 '15 15:06 zaklampert

Sounds like the backup is removing documents from your collection? If so isn't the removal of store data in S3 desired?

rhyslbw avatar Jun 03 '15 01:06 rhyslbw

I had the same problem, almost hit the production server. Its some cleanup logic in CFS that tries to remove files not referenced anymore.

See here: https://github.com/CollectionFS/Meteor-CollectionFS/blob/f28a3fcbfe86b999fcb2896363134fa9753d152e/packages/worker/fileWorker.js#L55

strikeout avatar Aug 11 '15 14:08 strikeout

Yep, I have this problem too, multiple environments are using the same store, and data being pushed around between them results in vanished files.

@strikeout did you just overwrite this method?

jeffyamada avatar May 09 '16 20:05 jeffyamada

Hey guys - just FYI, looks like I solved this by using --excludeCollection=cfs.[your-collection].filerecord so file collections don't get overwritten. One thing to note however is that you'll probably want to organize a couple instances of storage locations so production files aren't so easily manipulated by non-production ones etc. You can then write specific scripts to move the files collections to and from as well. Not the nicest solution, but will be fine once migration scripts are updated accordingly.

jeffyamada avatar May 09 '16 21:05 jeffyamada