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
- Back up the MongoDB database. For more information about backing up Satellite, see Backing Up Satellite Server and Capsule Server.
Procedure
Stop Pulp services:
satellite-maintain service stop --only \ pulp_celerybeat.service,pulp_resource_manager.service,pulp_streamer.service,pulp_workers.service,httpd
# satellite-maintain service stop --only \ pulp_celerybeat.service,pulp_resource_manager.service,pulp_streamer.service,pulp_workers.service,httpd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Access the MongoDB shell:
mongo pulp_database
# mongo pulp_database
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the amount of disk space used by MongoDB before a repair:
> db.stats()
> db.stats()
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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.
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()
> db.repairDatabase()
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the amount of disk space used by MongoDB after a repair:
> db.stats()
> db.stats()
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Exit the MongoDB shell:
> exit
> exit
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start Pulp services:
satellite-maintain service start
# satellite-maintain service start
Copy to Clipboard Copied! Toggle word wrap Toggle overflow