Chapter 11. Maintaining Satellite Server

This chapter provides information on how to maintain a Red Hat Satellite Server, including information on how to work with audit records, how to clean unused tasks, how to recover Pulp from a full disc, and how to reclaim disc space from MongoDB.

11.1. Deleting Audit Records

Audit records are created automatically in Satellite. You can use the foreman-rake audits:expire command to remove audits at any time. You can also use a cron job to schedule audit record deletions at the set interval that you want.

By default, using the foreman-rake audits:expire command removes audit records that are older than 90 days. You can specify the number of days to keep the audit records by adding the days option and add the number of days.

For example, if you want to delete audit records that are older than seven days, enter the following command:

# foreman-rake audits:expire days=7

11.2. Anonymizing Audit Records

You can use the foreman-rake audits:anonymize command to remove any user account or IP information while maintaining the audit records in the database. You can also use a cron job to schedule anonymizing the audit records at the set interval that you want.

By default, using the foreman-rake audits:anonymize command anonymizes audit records that are older than 90 days. You can specify the number of days to keep the audit records by adding the days option and add the number of days.

For example, if you want to anonymize audit records that are older than seven days, enter the following command:

# foreman-rake audits:anonymize days=7

11.3. Cleaning Unused Tasks

Cleaning unused tasks reduces disk space in the database and limits the rate of disk growth. When you perform regular cleaning, Satellite backup completes faster and overall performance is higher.

To clean unused tasks

The installer has a feature to enable a cron job to automatically remove old tasks. This feature is not enabled by default to avoid unwanted tasks cleanup.

  1. Enable the cron job:

    # satellite-installer --foreman-plugin-tasks-automatic-cleanup true
  2. By default, the cron job is scheduled to run every day at 19:45. To adjust to the time, change the value of the --foreman-plugin-tasks-cron-line parameter:

    # satellite-installer --foreman-plugin-tasks-cron-line "00 15 * * *"

    The previous command schedules the cron job to run every day at 15:00, see man 5 crontab for more details on cron format.

To change the period after which to delete all the tasks and to configure further advanced settings of the cron job, change the content of the /etc/foreman/plugins/foreman-tasks.yaml file.

11.4. Recovering from a Full Disk

The following procedure describes how to resolve the situation when a logical volume (LV) with the Pulp database on it has no free space.

To recover from a full disk

  1. Let running Pulp tasks finish but do not trigger any new ones as they can fail due to the full disk.
  2. Ensure that the LV with the /var/lib/pulp directory on it has sufficient free space. Here are some ways to achieve that:

    1. Remove orphaned content:

      # foreman-rake katello:delete_orphaned_content RAILS_ENV=production

      This is run weekly so it will not free much space.

    2. Change the download policy from Immediate to On Demand for as many repositories as possible and remove already downloaded packages. See the Red Hat Knowledgebase solution How to change syncing policy for Repositories on Satellite 6.2 from "Immediate" to "On-Demand" on the Red Hat Customer Portal for instructions.
    3. Grow the file system on the LV with the /var/lib/pulp directory on it. For more information, see Growing a File System on a Logical Volume in the Red Hat Enterprise Linux 7 Logical Volume Manager Administration Guide.

      Note

      If you use an untypical file system (other than for example ext3, ext4, or xfs), you might need to unmount the file system so that it is not in use. In that case:

      • Stop the satellite-maintain services:
      # satellite-maintain service stop
      • Grow the file system on the LV.
      • Start the satellite-maintain services:
      # satellite-maintain service start
  3. If some Pulp tasks failed due to the full disk, run them again.

11.5. Reclaiming Disk Space from MongoDB

The MongoDB database can use a large amount of disk space especially in heavily loaded deployments. The following procedure describes how to reclaim some of this disk space.

Prerequisites

To reclaim disk space from MongoDB

  1. Access the MongoDB shell:

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

    > db.stats()
  3. 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.
  4. Enter the repair command:

    > db.repairDatabase()

    Note that the repair command blocks all other operations and can take a long time to complete, depending on the size of the database.

  5. Check the amount of disk space used by MongoDB after a repair:

    > db.stats()
  6. Start Pulp services:

    # systemctl start goferd httpd pulp_workers pulp_celerybeat \
    pulp_resource_manager pulp_streamer