Cannot execute the compact command : command not allowed

Adding something to Chris’s statement, I would just say that it is necessary to access each node using port 27017 directly, so that it can be executed specifically on the node. I have a Python script that I made, with my requirements, but that you could adjust as needed, to perform compaction and failover when it is a primary. It works for both shard and replicaset. If you want it, contact me and I will send it to you.

1 Like