Red Hat Training

A Red Hat training course is available for Red Hat Satellite

Chapter 15. Synchronizing Content Between Satellite Servers

Red Hat Satellite 6.4 uses Inter-Satellite Synchronization (ISS) to synchronize content between upstream and downstream servers. In the context of ISS, upstream refers to the server from which content is exported; downstream refers to the server into which content is imported.

ISS is designed to address two scenarios:

  • If you have both connected and disconnected Satellite Servers, and want to copy content from the connected servers to the disconnected servers. The only way that these disconnected Satellites are populated with content is by exports from a connected Satellite.
  • If you have a primary Satellite Server and want to promote some, but not all, content to other Satellite Servers. For example, you might have Content Views (CVs) that are validated by the IT department, and you want to promote the yum content from those CVs to a downstream Satellite.

If you do not want to maintain another management web UI and platform, and you want to perform management and provisioning to local clients, consider setting up a Capsule Server.

Bidirectional synchronization is not used in a disconnected environment. Content never passes from the disconnected server to the connected server.

You cannot synchronize content from Satellite Server to Capsule Server. Capsule Server supports synchronization natively.

Supported Synchronization Options

Satellite 6.4 supports the following synchronization options:

Only RPM, kickstart, and ISO files are exported. Content View definitions and metadata, such as package filters, is not transferred. Satellite does not support the export of Puppet, Docker, or OSTree content. Imports occur as a normal repository synchronization, and consequently always arrive in the Library environment.

These synchronization options include a range of history details about the export and import, depending on the type of content. For example:

  • The repository synchronization history includes upstream source information, as well as the time the export occurred.
  • The CV synchronization history includes the export time and version, as well as the import time, version, and upstream source.

15.1. Configuring an Export Destination

Inter-Satellite Synchronization by default uses the /var/lib/pulp/katello-export/ directory, as indicated by the pulp_export_destination setting. To change this directory you must create the new directory and configure the Pulp export destination setting.

Important

The directory used in this example is for demonstration purposes only. Confirm that the export directory has adequate space for the required export RPM and ISO files. Section 1.4, “Content Management Storage” provides information on estimating storage requirements. A temporary file is created during the export process in the /var/cache/pulp/ and directory, then transferred to the /var/lib/pulp/ directory. This means that storage space equal to twice the size of the repository being exported is required during the export process. The temporary file is deleted when the export is completed.

Procedure

  1. Create the export directory:

    # mkdir /var/www/html/pub/export
  2. Ensure the foreman user has read and write permissions on the export directory:

    # chown foreman:foreman /var/www/html/pub/export
  3. Configure the SELinux context:

    # semanage fcontext -a -t httpd_sys_rw_content_t \
    "/var/www/html/pub/export(/.*)?"
    # restorecon -RvF /var/www/html/pub/export
    # ls -Zd /var/www/html/pub/export
    drwxr-xr-x. foreman foreman system_u:object_r:httpd_sys_rw_content_t:s0 /var/www/html/pub/export
  4. Change the export destination:

    # hammer settings set \
    --name pulp_export_destination \
    --value your-export-directory

15.2. Synchronizing Content Using Content View Versions

You can use Content Views with multiple repositories to synchronize content between Satellite Servers. To do that, you must export a Content View version on Satellite Server, copy the exported directory or ISO files to another Satellite Server and import them there.

15.2.1. Creating a Content View for Exporting

Use this procedure to create a Content view and prepare it for exporting. You must create filters to include non-errata and errata products per date.

Procedure

  1. Navigate to Content > Content Views. Click Create New View.
  2. In the Name field, enter Export_CV.
  3. Click Save.
  4. In the Repository Selection area, select the repositories to be added to the CV and click Add Repositories.
  5. Navigate to Yum Content > Filters and click New Filter.
  6. In the Name field, enter Non-errata Products.
  7. From the Content type list, select Package.
  8. From the Inclusion type list, select Include.
  9. In the Description field, enter Include all non-errata Products.
  10. Click Save.
  11. Select the Include all RPMs with no errata check box.
  12. Navigate to Yum Content > Filters and click New Filter.
  13. In the Name field, enter Erratas until YYYY-MM-DD.
  14. From the Content type list, select Erratum - Date and Type.
  15. From the Inclusion type list, select Include.
  16. In the Description field, enter Include errata products until YYYY-MM-DD.
  17. Click Save.
  18. In the Errata Type area, select all Security, Enhancement and Bugfix errata types.
  19. Select the Updated On check box in Data type.
  20. Fill in the Start Date and End Date fields to configure the date range of Products for the filter.
  21. Click Save.
  22. Click Publish New Version, fill in the date ranges of repositories into the Description field. Clear the Force Yum Metadata Regeneration check box.
  23. Click Save to publish the CV version ready for exporting.

For CLI Users

  1. Enter the hammer content-view create command to create a new CV:

    # hammer content-view create \
    --name "Export_CV" \
    --organization "Default Organization"
  2. Enter the hammer content-view add-repository command to add repositories to the CV:

    # hammer content-view add-repository \
    --name "Export_CV" \
    --product "Red Hat Satellite" \
    --repository "Red Hat Satellite Tools 6 for RHEL 7 Server RPMs x86_64" \
    --organization "Default Organization"
    # hammer content-view add-repository \
    --name "Export_CV" \
    --product "Red Hat Satellite Capsule" \
    --repository "Red Hat Satellite Capsule Tools 6.2 for RHEL 7 Server RPMs x86_64" \
    --organization "Default Organization"
  3. Enter the hammer content-view filter create command to create a filter for including non-errata packages:

    # hammer content-view filter create \
    --content-view "Export_CV" \
    --inclusion true \
    --name "Non-errata_Products" \
    --type rpm \
    --original-packages true \
    --organization "Default Organization"
  4. Enter the hammer content-view filter create command to create a filter for including errata packages:

    # hammer content-view filter create \
    --content-view "Export_CV" \
    --inclusion true \
    --name "Erratas until YYYY-MM-DD" \
    --type erratum \
    --organization "Default Organization"
  5. Enter the hammer content-view filter rule create command to create a rule defining the date range:

    # hammer content-view filter rule create \
    --content-view "Export_CV" \
    --content-view-filter "Erratas until YYYY-MM-DD" \
    --end-date YYYY-MM-DD \
    --types security,enhancement,bugfix \
    --organization "Default Organization"
  6. Enter the hammer content-view publish command to publish the CV version ready for exporting. It is recommended to fill in the date ranges of repositories under the --description option.

    # hammer content-view publish \
    --name "Export_CV" \
    --description "Repositories until YYYY-MM-DD" \
    --force-yum-metadata-regeneration true \
    --async \
    --organization "Default Organization"

15.2.2. Exporting a Content View Version

You can export a version of a Content View to a directory. That means that you can label a particular version of a CV to suit your requirements. This way you can curate and track your exports and facilitate updates.

Satellite exports only RPM, kickstart, and ISO files. Content View definitions and metadata, such as package filters, are not exported. Satellite 6.4 does not support the export of Puppet, Docker, or OSTree content.

Using Chunked ISO Files

Satellite 6.4 supports exports to chunked ISO files. A chunked ISO is similar to a split ISO but with one significant difference. Satellite tracks the size of the ISO file, and if the total size of the files being added to the ISO exceeds that value, Satellite stops writing to the ISO and creates a new one in the series. The advantage of this is that you can specify the ISO file size (for example, 4.7 GB), and still export larger repositories. The result is multiple 4.7 GB ISO files that you can burn to DVDs.

You can add the --iso-mb-size parameter to specify the size of ISO export files. The default value is 4380 MB, the size of a single-sided, single-layer DVD.

Prerequisites

  • Ensure that the export directory is large enough to accommodate at least one Red Hat Enterprise Linux export. By default, the export directory is /var/lib/pulp/katello-export/.
  • Ensure that the /var/lib/pulp/ directory has free storage space equivalent to the size of the repositories being exported for temporary files created during the export process.
  • Ensure that the /var/cache/pulp directory has free storage space equivalent to twice of the size of the repository being exported for temporary files created during the export process.
  • Ensure that you set download policy to Immediate for all repositories within the Content View you export. For more information, see Section 5.4, “Configuring Download Policies”.
  • Ensure that you synchronize repositories within the Content View you export to the required date.

Procedure

Complete these steps to export a version of a Content View. Satellite exports versions of Content Views to a directory by default. You can add the --export-to-iso 1 parameter to export to an ISO file instead.

  1. Enter the hammer content-view version list command to determine which version of a Content View to export:

    $ hammer content-view version list --organization "Default Organization"
  2. Enter the hammer content-view version export command to export a version of a Content View. This command exports content to the directory specified in pulp_export_destination setting. For more information, see Section 15.1, “Configuring an Export Destination”.

    # hammer content-view version export --id 3

Incremental Export of a Content View Version

To avoid exporting large repositories when updating, you can use incremental updates to only export the recent updates from a Satellite Server. Incremental updates export the recent changes made in the local repository by using synchronization events set to a particular date and time.

The time stamp used for the calculations is the time that the RPMs were synchronized on Satellite Server. For example, if Red Hat adds RPMs to a repository on a Monday and then again on a Wednesday, you can synchronize your local repository on Thursday and then use the date of Wednesday to get only the Wednesday update.

To make an incremental-update repository, enter the hammer content-view version export command with the --since option. For example, the following command exports repositories that are 10 days old:

# hammer content-view version export --content-view-id 1 \
--since $(date +'%Y-%m-%dT%H:%M:%S%Z' -d "now-10days")

15.2.3. Importing a Content View as a Red Hat Repository

Use this procedure to import content that you exported from a Content View from Satellite Server. You can also recreate any custom products during the import process, but Red Hat products are not recreated because they must be created using a manifest.

Prerequisites

  • Export the Content View from Satellite Server. For more details, see Section 15.2.2, “Exporting a Content View Version”.
  • Ensure that the Satellite Server where you want to import content has the required manifests and entitlements for any content that you want to enable. You cannot enable repositories for which no entitlements exist.

To Import a Content View:

  1. Copy the exported directory to the /var/www/html/pub/export/ directory on the Satellite Server where you want to import content.
  2. In the web UI, navigate to Content > Subscriptions.
  3. Select Manage Manifests.
  4. On the Import/Remove Manifest tab, set the Red Hat CDN URL address field to match the location of a content directory and a listing file within the exported Content View.

    For example, if the exported CV is located in /var/www/html/pub/export/Default_Organization-Export_CV-v1.0, set the URL to the following form:

    http://satellite.example.com/pub/export/Default_Organization-Export_CV-v1.0/Default_Organization/content_views/Export_CV/1.0/`
  5. Click Save.
  6. Navigate to Content > Red Hat Repositories and enable the exported repository.
  7. On the Satellite Server where you import content, enter the hammer organization update command to add new repositories to an organization. Set the redhat-repository-url option to the directory corresponding to the version you want within the exported Content View.

    $ hammer organization update \
    --name "Default Organization" \
    --redhat-repository-url \
    http://satellite.example.com/pub/export/Default_Organization-Export_CV-v1.0/Default_Organization/content_views/Export_CV/1.0/
    
    Organization updated

15.3. Synchronizing Content Using Repositories

You can synchronize single repositories between Satellite Servers. To do that, you must export a repository on Satellite Server, copy the exported directory or ISO file to another Satellite Server and import it there.

15.3.1. Exporting a repository

Satellite exports repositories to a directory by default. You can add the --export-to-iso 1 parameter to export to an ISO file instead.

Satellite only exports RPM, kickstart, and ISO files. Satellite does not support the export of Puppet, Docker, or OSTree content. Imports occur as a normal repository synchronization, and consequently always arrive in the Library environment.

Using Chunked ISO Files

Satellite 6.4 supports exports to chunked ISO files. A chunked ISO is similar to a split ISO but with one significant difference. Satellite tracks the size of the ISO file, and if the total size of the files being added to the ISO exceeds that value, Satellite stops writing to the ISO and creates a new one in the series. The advantage of this is that you can specify the ISO file size (for example, 4.7 GB), and still export larger repositories. The result is multiple 4.7 GB ISO files that you can burn to DVDs.

You can add the --iso-mb-size parameter to specify the size of ISO export files. The default value is 4380 MB, the size of a single-sided, single-layer DVD.

Prerequisites

  • Ensure that the export directory is large enough to accommodate at least one Red Hat Enterprise Linux export. By default, the export directory is /var/lib/pulp/katello-export/.
  • Ensure that the /var/lib/pulp/ directory has free storage space equivalent to the size of the repositories being exported for temporary files created during the export process.
  • Ensure that the /var/cache/pulp directory has free storage space equivalent to twice of the size of the repository being exported for temporary files created during the export process.
  • Ensure that you set download policy to Immediate for all repositories you export. For more information, see Section 5.4, “Configuring Download Policies”.
  • Ensure that you synchronize repositories you export to the required date.

Procedure

  1. Enter the hammer repository list command to list the repositories which can be exported and identify their IDs, which are used in the export.
  2. Enter the hammer repository export command to export content from your Satellite Server. This command exports content to the directory specified in pulp_export_destination setting.

    # hammer repository export --id 1

15.3.2. Incremental Export of a Repository

To avoid exporting large repositories when updating, you can use incremental updates to only export the recent updates from a Satellite Server. Incremental updates export the recent changes made in the local repository by using synchronization events set to a particular date and time.

The time stamp used for the calculations is the time that the RPMs were synchronized on Satellite Server. For example, if Red Hat adds RPMs to a repository on a Monday and then again on a Wednesday, you can synchronize your local repository on Thursday and then use the date of Wednesday to get only the Wednesday update.

To make an incremental-update repository, enter the hammer repository export command with the --since option. For example:

# hammer repository export \
--id 1 \
--since 2010-01-01T12:00:00Z

15.3.3. Importing a Repository

Use this procedure to import repository to Satellite Server using the exported directory or ISO file. You can also recreate any custom products during the import process, but Red Hat products are not recreated because they must be created using a manifest.

Prerequisites

  • Export the repository from Satellite Server. For more details, see Section 15.3.1, “Exporting a repository”.
  • Ensure that the Satellite Server where you want to import content has the required manifests and entitlements for any content that you want to enable. You cannot enable repositories for which no entitlements exist.

Procedure

  1. Copy the exported directory to the /var/www/html/pub/export/ directory on the Satellite Server where you want to import a repository.
  2. In the web UI, navigate to Content > Subscriptions.
  3. Select Manage Manifests.
  4. On the Import/Remove Manifest tab, set the Red Hat CDN URL address field to match the location of a content directory and a listing file within the exported repository.

    For example, if the exported repository is located in /var/www/html/pub/export/Default_Organization-Red_Hat_Enterprise_Linux_7_Server_RPMs_x68_64, set the URL to the following form:

    http://satellite.example.com/pub/export/Default_Organization-Red_Hat_Enterprise_Linux_7_Server_RPMs_x68_64/Default_Organization/Library/`.
  5. Click Save.
  6. Navigate to Content > Red Hat Repositories and enable the exported repository.

15.3.4. Incremental Import of a Repository

When synchronizing from an incremental update, you must use the incremental synchronization settings. In the Satellite web UI, ensure the Mirror on Sync setting is disabled for the repositories before synchronizing.

If you are using the Hammer CLI, you must add the --incremental option. If you do not use the incremental synchronization settings, the repository content will be deleted and only the content from the incremental update will remain. Recovering from an accidental overwrite requires a full export and then synchronizing again.