How to perform vacuuming on the individual Red Hat Satellite 6 databases?

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.x
  • Red Hat Capsule 6.x

Issue

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.

  1. Take a backup/snapshot of the Satellite server.

  2. Stop all Satellite services except the postgresql service:

# satellite-maintain service stop --exclude postgresql
  1. Verify that the postgresql service is running:
# systemctl status postgresql -l
  1. To perform vacuuming of the foreman database (applicable only on Satellite server):
# su - postgres -c 'vacuumdb -fvz -d foreman'
  1. To perform vacuuming of the candlepin database (applicable only on Satellite server):
# su - postgres -c 'vacuumdb -fvz -d candlepin'
  1. To perform vacuuming of the pulpcore database (applicable on both Satellite server and Capsule server):
# su - postgres -c 'vacuumdb -fvz -d pulpcore'
  1. Restart Satellite services:
# satellite-maintain service restart
  1. 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.

SBR
Product(s)
Category

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.