11.6. Reclaiming MongoDB Space

The MongoDB database can use a large amount of disk space especially in heavily loaded deployments. Use this procedure to reclaim some of this disk space on Satellite.

Prerequisites

Procedure

  1. Stop Pulp services:

    # satellite-maintain service stop --only \
    pulp_celerybeat.service,pulp_resource_manager.service,pulp_streamer.service,pulp_workers.service,httpd
  2. Access the MongoDB shell:

    # mongo pulp_database
  3. Check the amount of disk space used by MongoDB before a repair:

    > db.stats()
  4. Ensure that you have free disk space equal to the size of your current MongoDB database plus 2 GB. If the volume containing the MongoDB database lacks sufficient space, you can mount a separate volume and use that for the repair.
  5. Enter the repair command. Note that the repair command blocks all other operations and can take a long time to complete, depending on the size of the database.

    > db.repairDatabase()
  6. Check the amount of disk space used by MongoDB after a repair:

    > db.stats()
  7. Exit the MongoDB shell:

    > exit
  8. Start Pulp services:

    # satellite-maintain service start