How to perform vacuuming on the individual Red Hat Satellite 6 databases?
Environment
- Red Hat Satellite 6.x
- Red Hat Capsule 6.x
Issue
-
After the deletion/cleanup of records from different Red Hat Satellite 6 database tables as described in Postgresql database is growing and disk space utilization of /var/lib/pgsql is increasing in Red Hat Satellite 6,
/var/lib/pgsqlis still showing high utilization of disk space. -
Various Satellite activities are much slower than usual - root cause shows huge
durationof postgres requests
Resolution
NOTE:
The vacuuming process requires downtime for the Red Hat Satellite server as all services will be stopped till the vacuuming process is completed.
-
Take a backup/snapshot of the Satellite server.
-
Stop all Satellite services except the
postgresqlservice:
# satellite-maintain service stop --exclude postgresql
- Verify that the
postgresqlservice is running:
# systemctl status postgresql -l
- To perform vacuuming of the
foremandatabase (applicable only on Satellite server):
# su - postgres -c 'vacuumdb -fvz -d foreman'
- To perform vacuuming of the
candlepindatabase (applicable only on Satellite server):
# su - postgres -c 'vacuumdb -fvz -d candlepin'
- To perform vacuuming of the
pulpcoredatabase (applicable on both Satellite server and Capsule server):
# su - postgres -c 'vacuumdb -fvz -d pulpcore'
- Restart Satellite services:
# satellite-maintain service restart
- Confirm that Satellite services are up and running:
# sleep 10 && satellite-maintain service status -b
# hammer ping
NOTE:
If the vacuuming process is taking time, open a new terminal for the Red Hat Satellite server and monitor the vacuuming activity using the following two commands:
# ps -aux | grep -i vacuum
# tail -f /var/lib/pgsql/data/pg_log/postgresql-`date +%a`.log
For Satellite 6.11 on RHEL 7 and below:
# ps -aux | grep -i vacuum
# tail -f /var/opt/rh/rh-postgresql12/lib/pgsql/data/log/postgresql-`date +%a`.log
For more KB articles/solutions related to Red Hat Satellite 6.x PostgreSQL-related Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x PostgreSQL-related Issues
Root Cause
The deletion of records from different database tables can still keep the disk space reserved in the database. To finish the cleanup process, it is also advised to perform vacuuming of the database.
Diagnostic Steps
When Satellite performance is degraded, check for long duration in postgres logs:
grep duration /var/lib/pgsql/data/log/postgresql-*.log | grep "[0-9][0-9][0-9][0-9][0-9].[0-9][0-9][0-9] ms"
If one spots some unusually high duration, it is worth running vacuuming.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.