Can I run the compact without shutting down each instance?


In the server structure, pramary, secondary, and arbiter are each physically operated.
mongo db version is 4.2.3.

Some of the documents were deleted in the oldest order because too many documents were accumulated in a specific collection.

However, even deleting documents did not release the storage area.

Upon checking, I found that mongodb’s mechanism retains reusable bytes even if the document is deleted.

Also, I found out that unnecessary disk space can be freed with the compact command in the WiredTiger engine. (compact — MongoDB Manual)

So I`m going to try this command.

Currently, all clients connected to the db are querying using the arbiter ip and port.

Since the DB is composed only of replication, not sharding, if each individual executes the compact command independently, Even if each instance is locked, it is expected that the arbiter will distribute the query to the currently available instances.

Is this possible?

Or, Should I shutdown each instance, run it standalone, run the compact command, and then reconfigure psa?