Back Up and Restore Using the Network File System Server

You can back up the Virtual Appliance data to the Network File System (NFS) server. Follow these steps to back up the Virtual Appliance data:

  1. Set up the NFS server
  2. Configure the NFS parameters
  3. Update Globals File for the NFS Server
  4. Back up the Virtual Appliance Data
  5. Restore the Virtual Appliance Data

Set Up the NFS Server

This section considers AlmaLinux OS as an example OS to install the NFS server. Follow these steps to install and configure the NFS server:

  1. Run the following commands to install the NFS server.
    dnf install nfs-utils
    mkdir -p /mnt/nfs_share
    chown nobody:nobody /mnt/nfs_share
    chmod 777 -R /mnt/nfs_share/
  2. Configure the NFS exports.
    /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:
    systemctl restart nfs-server
  4. Verify the NFS server status:
    systemctl status nfs-server

Configure the NFS Parameters on Virtual Appliance

Edit the globals.yaml.gotmpl Edit theglobals.yaml.gotmplfile with the NFS server details:

# NFS parameters
nfs:
server: 10.0.203.142
path: /mnt/nfs_share

Configure the NFS Server on theglobals.yaml.gotmplFile

  1. Create a repository to back up the data in the NFS server.
    Note: You can create repository only for the Elasticsearch backup. By default, the globals.yaml.gotmpl file uses the repo3 repository for MySQL and PostgreSQL.
    appdcli run es_backup create-fs-repo virtual-appliance-repo-nfs
  2. Enable thefs section for datastores to back up using the NFS server. See globals.yaml.gotmpl file.
    Elasticsearch
    # Backup config for datastores
    backup:
    elasticsearch:
    fs:
    enabled: true
    storage: 5Gi
    PostgreSQL
    # Backup config for datastores
    backup:
    postgresql:
    fs:
    enabled: true
    repoName: repo3
    storage: 5Gipg-
    MySQL
    # Backup config for datastores
    backup:
    mysql:
    fs:
    enabled: true
    repoName: repo3
    storage: 5Gi

Back Up the Virtual Appliance Data in the NFS Server

Snapshots capture the state of the datastore and can be used to restore data. You can store multiple snapshots in a single repository. The following commands stores the snapshots in the virtual-appliance-repo-nfs repository.

Create a snapshot for each datastore:

Elasticsearch
appdcli run es_backup create-snapshot <repo-name> <snapshot-name>
Example
appdcli run es_backup create-snapshot virtual-appliance-repo-nfs es-snapshot
PostgreSQL
appdcli run pg_backup create-snapshot <repo-name> <snapshot-name>
Example
appdcli run pg_backup create-snapshot repo3 pg-snapshot
MySQL
appdcli run mysql_backup create-snapshot <repo-name> <snapshot-name>
Example
appdcli run mysql_backup create-snapshot repo3 mysql-snapshot

Restore Snapshots from the NFS server

Use the snapshots that you have stored in NFS to restore the datastores.

  1. List the snapshots in the repository:
    Elasticsearch
    appdcli run es_backup list-snapshot <repo-name>
    Example
    appdcli run es_backup list-snapshot virtual-appliance-repo-nfs
    PostgreSQL
    appdcli run pg_backup list-snapshot <repo-name>
    Example
    appdcli run pg_backup list-snapshot repo3
    MySQL
    appdcli run mysql_backup list-snapshot <repo-name>
    Example
    appdcli run mysql_backup list-snapshot repo3
  2. Restore the datastore by one of the snapshots:
    Elasticsearch
    appdcli run es_backup restore-snapshot <repo-name> <snapshot-name>
    Example
    appdcli run es_backup restore-snapshot virtual-appliance-repo-nfs es_snapshot
    PostgreSQL
    appdcli run pg_backup restore-snapshot <repo-name>
    Example
    appdcli run pg_backup restore-snapshot repo3 pg_snapshot
    MySQL
    appdcli run mysql_backup restore-snapshot <repo-name>
    Example
    appdcli run mysql_backup restore-snapshot repo3 mysql_snapshot

Delete the Snapshots from the NFS Server

If you no longer require the snapshot, you can delete the snapshot from NFS.

Elasticsearch
appdcli run es_backup delete-snapshot <repo-name> <snapshot-name>
Example
appdcli run es_backup delete-snapshot virtual-appliance-repo-nfs es_snapshot
PostgreSQL
appdcli run pg_backup delete-snapshot <repo-name>
Example
appdcli run pg_backup delete-snapshot repo3 pg_snapshot
MySQL
appdcli run mysql_backup delete-snapshot <repo-name>
Example
appdcli run mysql_backup delete-snapshot repo3 mysql_snapshot