In a stand-alone environment, mongodb is used to cache the source code of web pages crawled by crawlers, without copying sets, fragments, etc. The use of mongodb is purely for convenience of access and improvement of storage efficiency.
At present, a collection takes up more than 50 g of space and has already extracted the data. It will not be used in the short term, but it is very difficult to capture it. It may still be used later, so I don’t want to delete it. The problem is that the hard disk is out of space. I want to transfer the collection and index files to the mobile hard disk and copy them back when necessary or use the mobile hard disk directory as the data directory. However, taking a newly-built test set to test, it is found that once these files are removed, mongod cannot be started and must be transferred back to start.
My question is:
1. How to ensure that the removal of the space-occupying collection and its corresponding index file will not affect the startup of mongod and the use of other Collections (there are other Collections in the data directory)
2. If the entire data directory is not copied, only the collection and index files will be copied to the new directory. If the new directory is used as the data directory later, will it also fail to start?
3. Are there files other than collection, index, log and lock files in the data directory similar to the functions of the registry? How to implement similar binding and unbinding operations
I checked the operations related to db and collection, and found no function to do the above work in the document, so please let me know.
Attached is a screenshot of the data directory:
You can consider the two methods of data migration mentioned in this article.