Backing up and restoring the user data on Ubuntu

To secure the user data in 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 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 Rational® Test Automation Server 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 the 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. Log in to the Ubuntu server and open a terminal.
  2. Run the following command to retrieve the case from IBM Cloud Pack repository:
    curl -o ibm-rtas-case-3.1012.0.tgz https://raw.githubusercontent.com/IBM/cloud-pak/master/repo/case/ibm-rtas-case-3.1012.0.tgz
  3. Run the following command to extract the case:
    tar xvf ibm-rtas-case-3.1012.0.tgz
  4. Change to the ibm-rtas-case/inventory/ibmRtasBase/files directory.

    This directory contains the backup.sh script which is required to complete the backup operation.

  5. Create a directory that contains metadata related to the Persistent Volume Claims and their Persistent Volumes by running the following command:
    sudo ./backup.sh create-pvc-links

    You can use the following optional parameter along with the create-pvc-links command:

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

    For example, backup.sh create-pvc-links -v ibm-rtas-case/inventory/ibmRtasBase/files/my-pvc-links creates a directory called my-pvc-links that stores the metadata required for backup.

    Remember:
    • If you did not provide the volume parameter, by default, the command creates a sub-directory in the same directory where you have the backup script.

    • You must ensure that the directory you create must be empty or not exist to avoid script failure.

    • If you specify a directory by using the -v parameter, then you must use the same parameter value when you restore the data.

  6. Run the following command to stop the cluster and Rational® Test Automation Server:
    k3s-killall.sh
  7. Run the following command to create a backup of the existing user data:
    sudo ./backup.sh create [options] <backup-file-name>

    After you run this command, a backup of the local Persistent Volumes is created. The backup is created as tar archives that is compressed by using gzip (.tar.gz). The create command archives the Persistent Volumes into the <backup-file-name>.

    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 <name of the namespace>
    • --volumes or -v: Use this parameter to specify the directory path of the Volumes. The syntax is:
      -volumes <path-of-the-directory>
      Remember:
      • If you did not provide the volume parameter, by default, the command creates a sub-directory in the same directory where you have the backup script.

      • If you specify a directory by using the -v parameter, then you must use the same parameter value when you restore the data.

    For example,
    sudo ./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.
  8. Run the following command to restart the cluster and Rational® Test Automation Server:
    sudo systemctl start k3s

Restoring the user data

You can restore the user data that is backed up in Rational® Test Automation Server at any point in time after you install latest version of server software.

About this task

The server data from Rational® Test Automation Server V10.0.2, Fix Pack 1 or earlier, can be migrated to Rational® Test Automation Server during the installation of latest version of the server software. For more information, see the Related information section.

Note: While restoring backed up user data from V10.1.1 to V10.1.2, on the terminal you see information about Kafka messages. You can ignore those messages as they do not affect the restoration process.

Procedure

  1. Log in to the Ubuntu server and open a terminal.
  2. Run the following command to retrieve the case from IBM Cloud Pack repository:
    curl -o ibm-rtas-case-3.1012.0.tgz https://raw.githubusercontent.com/IBM/cloud-pak/master/repo/case/ibm-rtas-case-3.1012.0.tgz
  3. Run the following command to extract the case:
    tar xvf ibm-rtas-case-3.1012.0.tgz
  4. Change to the ibm-rtas-case/inventory/ibmRtasBase/files directory.
    This directory contains the backup.sh script which is required to complete the restore operation.
  5. If you have not already done so, create a directory that contains metadata related to the Persistent Volume Claims and their Persistent Volumes by running the following command:
    sudo ./backup.sh create-pvc-links

    You can use the following optional parameter along with the create-pvc-links command:

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

    For example, backup.sh create-pvc-links -v ibm-rtas-case/inventory/ibmRtasBase/files/my-pvc-links creates a directory called my-pvc-links that stores the metadata required to restore your user data.

    Remember:
    • If you did not provide the volume parameter, by default, the command creates a sub-directory in the same directory where you have the backup script.

    • You must ensure that the directory you create must be empty or not exist to avoid script failure.

  6. Run the following command to stop the cluster and Rational® Test Automation Server:
    k3s-killall.sh
  7. Run the following command to restore the backed-up user data:
    sudo ./backup.sh restore [options] <backup-file-name>

    The restore command overwrites the existing Persistent Volumes with data from the <backup-file-name>.

    You can use the following parameters along with the restore command:

    • --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 <name of the namespace> [:<target-namespace>]
    • --release or -r: Use this parameter if the helm release name of the server to which the backup is being restored is different than the helm release name of the server where the backup was taken. The syntax is:
      --release <backup-release>:<target-release>
    • --volumes or -v: Use this parameter to specify the directory path of the Volumes. The syntax is:
      --volumes <path-of-the-directory>
    • -k or --confirm: Use this parameter to skip the confirmation step.

    For example,
    sudo ./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-2 release in the new-test-system namespace and skips the confirmation step.

  8. Run the following command to restart the cluster and Rational® Test Automation Server:
    sudo systemctl start k3s
    Note:
    • The cluster and Rational® Test Automation Server might take some time to restart and until that time, you cannot access the Rational® Test Automation Server URL.

    • You can run the kubectl get pods -A command to verify that the Kubernetes environment is working. After a while, the status of the pods must be Running state.

Results

You have backed up or restored the user data for Rational® Test Automation Server.