After using a TTL index on a collection, I noticed after several months that the Disk Usage never decreases. After a compact, I did recover my Disk Usage but only on the primary node, how to do it on the secondary one ? Did it did something wrong with TTL index to need compact operation ?
Hello Adrien,
You need to run the compact in every secondary that you have in your replica set. The TTL index doesn’t trigger any compact so, it needs to be done manually.
Otherwise, I don’t know why you expect a decrease on disk usage.
If you could tell me more about it, it would be fine.
We have seen that we have been near our limit of 40go, after having deleting a lot of document from a collection, we expected to lower it to not reach it. After the compact operation it has been ok, lower to 6go.
I understand that we have to do it manually but I don’t understand how do it on secondary ones.
Please, take a look at this explained answer:
Also it is given some great advices!
Many thanks, I will try this
Please, when you try it, let me know if it is the solution.
Thank you!
It works, just needed directConnection param at true. Thanks again