Feedback

  • Contents
 

Backup and restore configuration of CX Insights data

CX Insights allows you to backup data at regular intervals. In case, there is a system failure, you can also restore the backed-up-data to a new computer.

The procedures in this topic help you to configure data backup and restore settings for CX Insights.

Backup CX Insights data

You can configure the backup settings either in an all.yml file or run a script manually.

Configure CX Insights backup through Ansible

In this method, you can configure the backup criteria through Ansible installation. To start with, configure backup values even before running the Ansible installation. For more information about Ansible installation, see CX Insights server installation procedure.

Prerequisite

  • A share path (for example, NFS share) on the computer where you are configuring the backup.

  • User installing the CX Insights server must have write access to the share path.

To configure the backup settings

  1. Mount the shared backup directory (example, NFS share) on the local computer where you installed the CX Insights server. For example, /mnt/nfs/share. The mounted directory is the backup path that maintains the CX Insights backup data. You can verify the mounted path using the “mount|grep” command as shown in the following example.

mount|grep "/mnt/nfs/share"

  1. Configure the following values in the group_vars/all.yml file.

    • backup_dir – specify the backup directory path. For example, /mnt/nfs/share/gcxibackup. Configuring backup_dir is mandatory.

    • cron_schedule - specify the cron expression that defines the backup frequency in which the backup activity runs every day. Configuring cron_schedule is optional. However, if you do not define any expression, the backup activity runs at the default time every day, that is 12.00 am. An example cron expression to run the backup activity every day at 7.00 am and 12.00 pm looks like: "0 7,12 *  * *"

Note: Cron job is added for the root user only.

  1. Convert the cxinsight-backup-restore.sh file to Unix format. You can do the conversion either by running the dos2Unix tool or by running the sed command as shown below.

sed -i 's/\r//g' cxinsight-backup-restore.sh

  1. Log in as CX Insights user and run the Ansible installation using the following command.

sudo ansible-playbook --vault-id cxinsights@prompt -i inventory.yml site.yml -K

Note:

    • Running the above Ansible installation command installs the pods, and configures the backup settings which generate the .gcxi_backup_cron.sh file at /home/cxinsights/.gcxi_backup_cron.sh. However, it does not perform the actual backup. The actual backup is performed when the first scheduled backup activity runs or when the user backs up manually.

    • If backup configuration causes any errors in Ansible installation, correct the errors, and configure the backup settings manually.

    • You can verify the backup activity logs from the path /home/cxinsights/.gcxi_backup_trace.log  

Configure CX Insights backup through script

For some reasons, if Ansible installation fails to configure the backup settings, you can configure it manually by running a script.

To configure the backup settings

  1. Mount the shared backup directory (example, NFS share) on the local computer where you installed the CX Insights server. For example, /mnt/nfs/share. The mounted directory is the backup path that maintains the CX Insights backup data. You can verify the mounted path using the “mount|grep” command as shown in the following example.

mount |grep "/mnt/nfs/share"

  1. Run the script cxinsight-backup-restore.sh manually by providing the backup path and cron expression as shown below in the path /home/cxinsights/cxinsights-playbook-k3s

Syntax:

sudo cxinsight-backup-restore.sh backup <backup dir> ["Cron expression"(optional)]

Example:

sudo cxinsight-backup-restore.sh backup /mnt/nfs/share/gcxibackup "* */6 * * *"

Important:

    • Run the cxinsight-backup-restore.sh script only once. Rerunning the script overwrites log file and backs up old data in the configured backup path.

    • If you accidentally delete the volumes folder (for example, through helm delete), you must rerun the cxinsight-backup-restore.sh script to set up the backup path and the cron job schedule.

Instant backup

Run the following script if you want to backup CX Insights data instantly instead of waiting for the scheduled backup activity.

sudo /home/cxinsights/.gcxi_backup_cron.sh

Restore CX Insights data

You might want to restore old CX Insights data in case you replaced or upgraded your hardware. You can restore older data if you have a proper backup and you know the correct backup path.

You can provide the restore settings either in an all.yml file or run a script manually.

Prerequisite

A share path (for example, NFS share) of the computer where you are restoring the backup.

Configure CX Insights data restore through Ansible

To configure the restore settings,

  1. Follow the steps 1-3 in configuring CX Insight backup through Ansible procedure.

  2. Verify that the mounted directory has the following volume folders.

$ ls /mnt/nfs/share/gcxibackup

cube  gcxi-data  gcxi-volume

  1. In the group_vars/all.yml file, configure is_restore as true.

  1. Log in as CX Insights user and run the Ansible installation using the following command.

sudo ansible-playbook --vault-id cxinsights@prompt -i inventory.yml site.yml -K

Note:

  • Running the above command restores the CX Insights data and creates a new backup directory. You can find the restored data in an archive file created within the backup directory. The archive file is created with the date and time (example, gcxi-backup_2020-08-06_01-55-36.tar.gz) so that you can identify which file is relevant for you.

  • The Ansible installation requires several parameters to be configured as part of CX Insights server installation. For more information, see Install CX Insights server.

  1. Once restoration is successful and complete, change is_restore to its default value (false) in the group_vars/all.yml file. Changing is_restore back to its default value avoids unnecessary data restore during future upgrades.

Configure CX Insights data restore through script

If automatic restoration fails for any reason, you can restore the CX Insights data manually by using the following procedure.

  1. Follow the steps 1-3 in configuring CX Insight backup through Ansible procedure.

  2. Verify that the mounted directory has the following volume folders.

$ ls /mnt/nfs/share/gcxibackup

cube  gcxi-data  gcxi-volume

  1. Run the restore script cxinsight-backup-restore.sh by providing restore directory as shown in the following example.

sudo cxinsight-backup-restore.sh restore /mnt/nfs/share/gcxibackup

Running the restore script automatically creates the new backup path and restores the old data.

Note:

  • The time taken to restore the old data depends on its size. In test environment, the average duration to restore the old data is about 15 minutes approximately.

  • You can restore the old data that is backed up until the last backup activity. The dashboard or metrics created after the backup activity is complete and before the system failure cannot be restored. For example, if the backup activity runs at 10.00 pm every day, and if the system stopped responding at 11.00 pm, then the data created between 10.00 pm and 11.00 pm is not restored.

  • Do not use * in directory names.

Backup log files

You can find the archive of CX Insights log files such as application log, tomcat log, and so on, in the backup directory configured as part of backup settings. The log files are archived in the tar format with the archived date and time as its file name.

To backup log files, you do not need any specific configuration.

 

Related Topics:  

Install CX Insights server