Describe the distributed architecture and management features of Red Hat Satellite databases and perform maintenance tasks on a Red Hat Satellite Server database.
Red Hat Satellite stores package metadata and software packages on the disk. In heavily loaded Satellite Server deployments, this information can consume a large amount of disk space. For this reason, reclaiming previously used disk space is necessary before disk usage reaches its maximum and Satellite stops working correctly.
The PostgreSQL database on a Red Hat Satellite stores all the Satellite content metadata. When PostgreSQL updates or writes new data, database records are deleted or made obsolete. These database records are discarded from database operations, but they are not physically removed from the tables and they are still using disk space.
You can reclaim unused disk space by removing the discarded database records from the PostgreSQL database when necessary. Although you can perform these tasks at any time, reclaiming the PostgreSQL database disk space requires to stop all the Satellite Server services. Thus, you might want to schedule a maintenance window when Satellite Server is not heavily used. Scheduling a maintenance window for these tasks minimizes the possible impact to user operations.
To reclaim the disk space, first stop all the Satellite Server services except for the postgresql service:
[root@satellite ~]# satellite-maintain service stop --exclude postgresql
...output omitted...Then, run the following command as the postgres user:
[root@satellite ~]# su - postgres -c 'vacuumdb --full --dbname=foreman'
vacuumdb: vacuuming database "foreman"Finally, start all the Satellite Server services when the vacuum finishes:
[root@satellite ~]# satellite-maintain service start
...output omitted...Satellite Server uses download policies to control downloading content during content synchronization.
If you use the On Demand download policy, then Satellite downloads packages only when a first client requests them.
The downloaded package remains in the Satellite Server file system, and so it does not need to be downloaded again when another client requests the same package version.
However, if the package is updated and another client requests the package, then Satellite downloads and stores the new package version.
To free disk space, you can remove packages from the Satellite Server file system. Remove any packages from the Satellite Server file system if they are different package versions or old packages that clients are unlikely to use again. Removing packages from the Satellite Server file system does not remove them from the client host or from the client host's cache.
To remove the downloaded packages for one or more repositories, navigate to → in the Satellite web UI. Select the product. On the tab, select the checkboxes for the appropriate repositories. From the list, click .
To remove the downloaded packages for a Capsule Server, navigate to → in the Satellite web UI. Select the Capsule Server. Then, click .
Red Hat Satellite stores records in the disk for audit and troubleshooting purposes. To free disk space, you can remove records that are expired or no longer of interest.
Satellite Server keeps a record of commands that users perform on the server.
The hammer audit command queries the audit records.
The list subcommand displays audit records, by using options to select the types of audit records to list.
The info subcommand displays more information about individual audit records.
The foreman-rake command can manage Satellite Server audit records.
The audits:expire subcommand removes old audit records.
The following command removes all audit records that are more than 30 days old:
[root@satellite ~]# foreman-rake audits:expire days=30If you omit the days= argument, then the default retention period is 90 days.N
The foreman-rake command also supports the audits:anonymize subcommand.
Although this command does not save space because it keeps all of the audit records, it removes user account and IP information for old audit records.
This subcommand also has a days= option that specifies how old records must be anonymized.N
Satellite Server automatically creates report records for hosts with errors or that performed any action through Puppet.
The hammer config-report command queries the report records.
The list subcommand displays report records, by using options to select the types of report records to list.
The info subcommand displays more information about individual report records.
The foreman-rake command can manage Satellite Server report records.
The reports:expire subcommand removes old report records.
The following command removes all report records that are more than 30 days old:
[root@satellite ~]# foreman-rake reports:expire days=30If you omit the days= argument, then the default retention period is 90 days.N
Status information about scheduled tasks remains on Satellite Server after tasks complete, both for successful tasks and for tasks that exit with an error.
Satellite Server executes a cron job every day at 19:45 to automatically remove successful older tasks than 30 days and all older tasks than a year.
This cron job is executed by default for fresh Satellite 6.11 installations.
If you upgrade Satellite Server from previous versions, then you can enable the cron job to automatically remove old tasks by using the following command:
[root@satellite ~]# satellite-installer --foreman-plugin-tasks-automatic-cleanup \
trueYou can modify the default time for the cron job.
For example, the following command changes the cron job time to be 23:30 every day.
[root@satellite ~]# satellite-installer --foreman-plugin-tasks-cron-line \
'30 23 * * *'The syntax for the time specification uses standard cron syntax.
You can define more advanced task configurations to remove previous tasks information by adjusting the settings in the /etc/foreman/plugins/foreman-tasks.yaml file.
This file contains the rules that define the age of tasks that are deleted each time that the cron job runs.
For more information, see the Managing Satellite Server chapter in the Administering Red Hat Satellite guide at https://access.redhat.com/documentation/en-us/red_hat_satellite/6.11/html-single/administering_red_hat_satellite/index#Maintaining_Server_admin