Automated stepdown and compactions for cloud¶
This guide explains how to set up automated compactions for your instance. Follow this link for more information about MongoDB space usage. Use this link for more information about the ObjectRocket automated compaction process.
What is a stepdown?¶
A stepdown is a graceful election to promote a new shard member as primary. The ObjectRocket shards come provisioned with 1 primary and 2 secondary members. The primary member willingly gives up its status and lets one of the secondaries be promoted. ObjectRocket uses stepdowns to allow for performing maintenance on shards members.
What is a compaction?¶
A compaction is a two-phase process during which your shard members (1 primary and 2 secondaries) are compacted, one at a time behind the scenes. During the first phase, your secondaries are compacted. To move from phase one to phase two, a stepdown needs to occur on the primary member. The stepdown takes 5 to 15 seconds, during which writes and primary reads can’t take place. Modern MongoDB drivers handle this operation gracefully, but you might need to restart the application to clear stale connections.
ObjectRocket recommends that you schedule your stepdowns during non-peak hours. After the stepdown completes, a compaction of the former primary member occurs, thus compacting the whole instance.
Understanding the stepdown window¶
To access the stepdown window, use the following steps:
Select your MongoDB instance from the ObjectRocket UI.
Select Settings. The stepdown window displays.
Stepdown Scheduled: A switch to turn stepdowns on and off. Turn on this switch so that your instance can automatically stepdown after a compaction completes.
Stepdown Window (UTC): The timeframe during which your instance is allowed to stepdown the primary members. Stepdown Window should be a minimum of 30 minutes. If possible, set this window between 30 minutes and 1 hour.
Enable Weekly Stepdown: Allows stepdowns to occur during the Stepdown Window. Enable Weekly Stepdown to ensure that your stepdowns occur during the non-peak hours specified in your Stepdown Window.
Enable Weekly Compaction: Allows your instance to perform automated compactions during the Stepdown Window. While you can kick off compactions manually in the UI, ObjectRocket recommends that you enable weekly compactions. MongoDB fragments over time and weekly stepdowns ensure that your instance maintains as small of a footprint on disk as possible.
Contact email@example.com if you have any questions about compactions or stepdowns.