Back Up and Restore Using an NFS Server

Use a Network File System (NFS) server to back up and restore Virtual Appliance data.

You can back up Virtual Appliance data to an NFS server. Complete the following tasks in order:

  1. Set Up the NFS Server
  2. Configure NFS Parameters on the Virtual Appliance
  3. Configure NFS Backup Settings
  4. Back Up Virtual Appliance Data
  5. Restore Snapshots
  6. Delete Snapshots

Set Up the NFS Server

Install and configure an NFS server on AlmaLinux or Ubuntu for Virtual Appliance backups.

Follow these steps to install and configure the NFS server on AlmaLinux or Ubuntu:

  1. Run the following commands to install the NFS server.
    AlmaLinux
    CODE
    sudo dnf install nfs-utils
    sudo mkdir -p /mnt/nfs_share
    sudo chown nobody:nobody /mnt/nfs_share
    sudo chmod 777 -R /mnt/nfs_share/
    Ubuntu
    CODE
    sudo apt install nfs-kernel-server
    sudo mkdir -p /mnt/nfs_share
    sudo chown nobody:nogroup /mnt/nfs_share
    sudo chmod 777 -R /mnt/nfs_share/
  2. Configure the NFS exports.
    CODE
    /mnt/nfs_share 10.0.203.0/24(rw,sync,no_subtree_check,no_root_squash)
    /mnt/nfs_share 10.0.202.0/24(rw,sync,no_subtree_check,no_root_squash)
  3. Restart the NFS server:
    CODE
    sudo systemctl restart nfs-server
  4. Verify the NFS server status:
    CODE
    sudo systemctl status nfs-server

Configure NFS Parameters on the Virtual Appliance

Configure NFS server parameters for Virtual Appliance nodes that use NFS backup storage.

Edit the nfs section in the globals.yaml.gotmpl file with the NFS server details on each applicable Virtual Appliance node.

The following example shows NFS parameters:

CODE
# NFS parameters
nfs:
	enabled: true
	server: 10.0.203.142
	path: /mnt/nfs_share

Configure NFS Backup Settings in the globals.yaml.gotmpl File

Enable NFS backup settings for datastores in the globals.yaml.gotmpl file.

  1. Enable the fs section for each datastore that you want to back up using the NFS server. See globals.yaml.gotmpl file.
    Elasticsearch
    CODE
    # Backup config for datastores
    backup:
      elasticsearch:
        fs:
          enabled: true
          storage: 5Gi
    PostgreSQL
    CODE
    # Backup config for datastores
    backup:
      postgresql:
        fs:
          enabled: true
          repoName: repo3
          storage: 5Gi
    MySQL
    CODE
    # Backup config for datastores
    backup:
      mysql:
        fs:
          enabled: true
          repoName: repo3
          storage: 5Gi
          backupType: xtrabackup
          xtrabackup:
            # Maximum number of full backups to retain in S3/FS (0 = unlimited)
            retentionMaxFull: 3
            # Set to false to skip --lock-ddl (use only if MySQL is quiesced or DDL won't run during backup)
            lockDdl: true
            schedule:
              # Cron expression for full backups (empty string disables)
              full: ""
              # Cron expression for incremental backups (empty string disables)
              incr: ""
              # MySQL pod to backup from
              pod: "appd-mysql-0"
  2. (Optional) Create a repository for Elasticsearch backups on the NFS server.
    Note:
    • In a standard deployment, Elasticsearch data is stored within the Virtual Appliance. The Elasticsearch backup and restore steps apply only to a standard deployment.

    • You can create a repository only for Elasticsearch backups.

      By default, the globals.yaml.gotmpl file uses the repo3 repository for MySQL and PostgreSQL.

    CODE
    appdcli backup elasticsearch create-fs-repo repo3
  3. Synchronize the changes across nodes.
    CODE
    appdcli sync appd <profile>

Back Up Virtual Appliance Data to an NFS Server

Back up Virtual Appliance datastore snapshots to a Network File System server.

Snapshots capture the state of a datastore and can be used to restore data. You can store multiple snapshots in one repository. The following commands store snapshots in the repo3 repository.

Create a snapshot for each datastore:

Elasticsearch
CODE
appdcli backup elasticsearch create-snapshot <repo-name> <snapshot-name>
Example
CODE
appdcli backup elasticsearch create-snapshot repo3 es-snapshot
PostgreSQL
CODE
appdcli backup postgres create-snapshot <repo-name>
Example
CODE
appdcli backup postgres create-snapshot repo3
MySQL
CODE
appdcli backup mysql create-snapshot <repo-name>
Example
CODE
appdcli backup mysql create-snapshot repo3

Restore Snapshots from the NFS Server

Restore Virtual Appliance datastore snapshots stored on an NFS server.

Use snapshots stored on the NFS server to restore the datastores.

  1. List the snapshots in the repository.
    Elasticsearch
    CODE
    appdcli backup elasticsearch list-snapshot <repo-name>
    Example
    CODE
    appdcli backup elasticsearch list-snapshot repo3
  2. Restore the datastore from a snapshot.
    Elasticsearch
    CODE
    appdcli backup elasticsearch restore-snapshot <repo-name> <snapshot-name>
    Example
    CODE
    appdcli backup elasticsearch restore-snapshot repo3 es_snapshot
    PostgreSQL
    CODE
    appdcli backup postgres restore-snapshot <repo-name> <snapshot-name>
    Example
    CODE
    appdcli backup postgres restore-snapshot repo3 pg_snapshot
    MySQL

    Restore the MySQL dumpInstance.

    CODE
    appdcli backup mysql restore-snapshot <repo-name>
    Restore the MySQL XtraBackup:
    CODE
    appdcli backup mysql list-chains
    
    # Latest chain and all incremental backups
    appdcli backup mysql restore 
    
    # Selected chain and all incremental backups
    appdcli backup mysql restore --from-chain <timestamp> 
    
    # Selected chain through an incremental backup, inclusively
    appdcli backup mysql restore --from-chain <timestamp> --from-incr <timestamp> 
    
    # Full backup only
    appdcli backup mysql restore --from-chain <timestamp> --from-incr full
    Note: You must manually restore the MySQL cluster.
    Note: Some services might restart during snapshot restoration. To minimize disruption, schedule the restore procedure during planned service downtime.

Delete Snapshots from the NFS Server

Delete Virtual Appliance datastore snapshots that you no longer need from NFS storage.

Delete snapshots that you no longer need from NFS storage.

Delete the snapshot.
Elasticsearch
CODE
appdcli backup elasticsearch delete-snapshot <repo-name> <snapshot-name>
Example
CODE
appdcli backup elasticsearch delete-snapshot repo3 es_snapshot