Chapter 9. Managing Subscription Asset Manager Instances

This chapter covers basic maintenance tasks for Subscription Asset Manager instances, such as backing up and restoring data.

9.1. Backing up Subscription Asset Manager

There is no utility to back up all Subscription Asset Manager information. The configuration files must be saved manually, and the backend database data must be dumped to a backup file.
All backup operations must be performed as root.
  1. Create the desired backup directory. In this example, umask is set so that the directory is created with the proper permissions. Then, the directory is added to the postgres system group because Subscription Asset Manager uses a PostgreSQL database as its backend.
    [root@server]# umask 0017
    [root@server]# mkdir /backup
    [root@server]# chgrp postgres /backup
  2. Open the backup directory.
    [root@server]# cd /backup
  3. Use tar or zip to create an archive of all of the Subscription Asset Manager configuration files. For example:
    [root@server]# tar --selinux -czvf config_files.tar.gz \
    /etc/katello \
    /etc/elasticsearch \
    /etc/candlepin \
    /etc/gofer \
    /etc/grinder \
    /etc/pki/katello \
    /etc/pki/pulp \
    /etc/qpidd.conf \
    /etc/sysconfig/katello \
    /etc/sysconfig/elasticsearch \
    /root/ssl-build \
    /var/www/html/pub/*
  4. Create a separate archive for the Elastic Search directory.
    [root@server]# tar --selinux -czvf elastic_data.tar.gz /var/lib/elasticsearch
  5. Back up all of the PostgreSQL databases. The default database names are katelloschema and candlepin.
    If the Subscription Asset Manager instance is not using the default names, then the custom values will be in the db_name parameters in the katello-configure.conf file.
    [root@server]# grep db_name /etc/katello/katello-configure.conf
    Run the pg_dump command for each database to create a backup. This can take several minutes, depending on the sizes of the databases.
    [root@server]# su postgres -c "pg_dump -Fc katelloschema > /backup/katello.dump"
    [root@server]# su postgres -c "pg_dump -Fc candlepin > /backup/candlepin.dump"
    The postgres service must be running for the pg_dump command to work. If the service is not running, then the databases can be backed up by zipping or tarring the PostgreSQL data directory. For example:
    [root@server]# tar --selinux -czvf pgsql_data.tar.gz /var/lib/pgsql/data/
    Simply archiving the entire directory backs up all databases. Since all of the databases are shut down, the data directory should only be archived during a maintenance period.
    For more information about PostgreSQL backups, consult the pg_dump man page or the PostgreSQL documentation.
  6. After running pg_dump, check that the appropriate .dump files have been created in the specified backup directory. For example:
    # ls /backup
    candlepin.dump    config_files.tar.gz    elastic_data.tar.gz    katello.dump