Backing up and restoring the user data on Ubuntu

To secure the user data in IBM® Rational® Test Automation Server that is installed on the Ubuntu server, you can back up the user data. At any point in time, after you install IBM® Rational® Test Automation Server, you can restore the backed-up user data.

Before you begin

You must have completed the following tasks:

  • Been granted with the same permissions that are required for installing and uninstalling the software.
  • Been granted with the sudo access.
  • Communicated to the users that the system might be unavailable for some time until the process is complete.

About this task

You may need to back up and restore the user data in these following scenarios:
  • Move the existing environment to a new system
  • Change the release name or the namespace
  • Back up the user data at regular intervals and restore the backed-up data when required

Backing up the user data

You can back up the user data in Rational® Test Automation Server and use the backed-up data to restore at any point in time.

Procedure

  1. Open a terminal and change to the directory where you extracted hcl-onetest-base-1.101.0.tgz.
  2. Change to the hcl-onetest-case/inventory/hclonetestbase/file directory. This directory contains the backup.sh and restore.sh scripts which are required to complete the backup and restore operations.
  3. Stop Kubernetes by entering the following command:

    microk8s.stop

  4. Create a backup of the existing user data by entering the following command:

    sudo ./backup.sh create [options] <backup-name>

    After you run this command, a backup of the local Persistent Volumes is created. The backups are created as tar archives that are compressed by using gzip (.tar.gz).

    The create command archives the Persistent Volumes into the <backup-file>.

    You can use the following parameters along with the create command:
    • --namespace or -n: Use this parameter to back up the Persistent Volumes in the specified namespace. If you do not mention the namespace, then all the Volumes from all the namespaces are included in the backup.

      The syntax is -namespace <namespace>

    • --volumes or or -v: Use this parameter to specify the path of the Volumes.

      The syntax is -volumes <directory>

      The default path of the directory is /var/snap/microk8s/common/default-storage

    For example, ./backup.sh create --namespace test-system my-backup.tar.gz

    This command creates a backup file named my-backup.tar.gz that contains all of the Persistent Volumes associated with pods available in the test-system namespace.

    The backup is created.
  5. Restart Kubernetes to start Rational® Test Automation Server by entering the following command:

    microk8s.start

Restoring the user data

You can restore the user data that is backed up in Rational® Test Automation Server V10.1.0 at any point in time after you install Rational® Test Automation Server V10.1.0. The user data from Rational® Test Automation Server V10.0.2, Fix Pack 1 or earlier, can be migrated to Rational® Test Automation Server V10.1.0 during the installation of Rational® Test Automation Server V10.1.0. You can refer to the installation instructions to migrate the user data to Rational® Test Automation Server V10.1.0.

Procedure

  1. Open a terminal and change to the directory where you extracted hcl-onetest-base-1.101.0.tgz.
  2. Change to the hcl-onetest-case/inventory/hclonetestbase/file directory. This directory contains the backup.sh and restore.sh scripts which are required to complete the backup and restore operations.
  3. Stop Kubernetes by entering the following command:

    microk8s.stop

  4. Restore the backed-up user data by entering the following command:

    sudo ./backup.sh restore [options] <backup-name>

    The restore command overwrites the existing Persistent Volumes with data from the <backup_file>. This command can restore the compressed or uncompressed tar files.

    You can use the following parameters along with the restore parameter:
    • --namespace or -n: Use this parameter to restore a specific namespace from the backup file. If you do not mention the namespace, then volumes from all the namespaces in the backup file are restored. You can map one namespace to another namespace by using colon (:).

      The syntax is --namespace <namespace>[:<target-namespace>]

    • --release or -r: Use this parameter if the release to which the backup is being restored is different to that in the backup.

      --release <backup-release>:<target-release>

    • --volumes or or -v: Use this parameter to back up the volumes that are associated with the namespace that you want to back up.

      The syntax is --volumes <directory>

      The directory path contains the volumes, which are expressed as an absolute path. The default path is /var/snap/microk8s/common/default-storage

    • -k or --confirm: Use this parameter to skip the confirmation step.

    For example, ./backup.sh restore --namespace test-system:new-test-system -r rel-1:rel-2 -k my-backup.tar.gz

    This command restores the volumes that are backed up from the rel-1 release in the test-system namespace to the rel-1 release in the new-test-system namespace and skips the confirmation step.

  5. Restart Kubernetes to start Rational® Test Automation Server by entering the following command:

    microk8s.start

    Note: Although the pods are restored, the server might take some time to start.