git - Would directly copying a mongodb database causes problems? -
we push our project git , mongodb data files in committed directories.
we found when pull project onto machine, failed insert document collection. however, if drop collection , recreate collection same name, insertion success. why failed insert , why succeed again recreate collection?
i new mongodb, need help. thanks.
provided cleanly shutdown mongod in question, copying contents of --dbpath not problem. actually, considered valid practice backup purposes.
when copying files of running instance, copying lock files , journaling data deleted during clean shutdown. may prevent write access collections.
when delete collection, metafiles reset , of course can insert then.
so have do:
- shut down first instance cleanly
- add, commit , push contents of
dbpath - restart first instance
- shutdown target instance if running
- pull data
- restart target instance
Comments
Post a Comment