Backing up the server data on Ubuntu
When you want to upgrade to a new version of the server software or to move your existing environments to new systems, you must back up the server data.
Before you begin
You must have completed the following tasks:
-
Been assigned the same role that was required to install and uninstall the server software.
-
Been granted with the sudo access.
-
Installed the server software and all of the HCL OneTest™ Server pods are in Running state.
-
Communicated to the users that HCL OneTest™ Server might be unavailable for some time until the process is complete.
Procedure
- Log in to the Ubuntu server and open a terminal.
-
Add the software registry to Helm by running the following command:
helm repo add hclsoftware https://hclcr.io/chartrepo/ot --username {okta-email-address} --password {harbor-cli-secret}
Note: You must replace{okta-email-address}
with the user name of the Harbor repository and replace{harbor-cli-secret}
with the secret key that you copied from the Harbor repository.If the user name contains any special characters, such as $, you must enclose it within single quotes.
-
Run the following command to extract the base:
helm pull --untar hclsoftware/hcl-onetest-base --version 5.1020.0
-
Change to the hcl-onetest-base directory.
This directory contains the
backup.sh
script which is required to complete the backup operation. -
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 hcl-onetest-base/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.
-
-
Run the following command to stop the cluster and HCL OneTest™ Server:
k3s-killall.sh
-
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,
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.sudo ./backup.sh create --namespace test-system my-backup.tar.gz
-
-
Run the following command to restart the cluster and HCL OneTest™ Server:
sudo systemctl start k3s
Results
You have backed up the data of HCL OneTest™ Server.