0

I have to keep several copies of production databases serving by a dockerized MongoDB server.

I do NOT want to backup, then to drop, then, when I need it again, to restore it. It is not as quick process as I would want it to be.

But when I keep those DBs online, MongoDB server eats a lot of my host system memory (16Gb total physical RAM).

I would like to detach some specific databases in order to free some memory and attach them again when I need them.

I tried to search the answer with google, but without success.

MongoDB 4.0, LinuxMint 19.3 Tricia

1

I tried to search the answer with google, but without success.

I'm pretty sure MongoDB does not offer "offlining" or "detaching" databases like traditional RDBMS products do, at this time (hence you not being able to find anything on it).

Have you set storage.wiredTiger.engineConfig.cacheSizeGB and hostInfo.system.memLimitMB to limit the RAM being used by MongoDB? If not set it will default to 50% of (RAM - 1 GB), which might be your actual problem.

AFAIK Mongo shouldn't be loading unused database data into RAM, and the RAM to keep databases online should be negligible.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.