Backing up and Restoring AtScale

The following topic covers how to perform a full backup and restore of all files within /opt/atscale for both stand-alone and clustered AtScale instances. This includes backing up and restoring data, configurations, logs and other files.

Note: This section covers fully backing up and restoring all files within /opt/atscale on stand-alone and clustered AtScale instances. To perform a backup of embedded AtScale Postgres database instances, see Backing up and Restoring AtScale Database Instances.

Before You Begin

To perform a full backup, you must have the correct permissions to copy the database with all owners and permissions intact. This typically requires sudo access.

Backing up Stand-Alone AtScale

Use the following procedure to perform a full backup, including database, of a stand-alone AtScale installation. The following steps need to be executed by a user with the correct permissions (typically a user who has sudo access).

  1. Remove any old AtScale versions that are no longer in use. AtScale recommends removing old versions using the package manager that was used to install AtScale.

  2. Shut down AtScale in order to ensure a complete backup.

    $ /opt/atscale/bin/atscale_stop
  3. Perform the complete backup.

    $ cp -Rp /opt/atscale /opt/atscale.bak
  4. After the backup is complete, you can start AtScale again.

    $ /opt/atscale/bin/atscale_start

Restoring Stand-Alone AtScale from a Backup

Use the following procedure to restore a previously running AtScale installation. The following steps need to be executed by a user with the correct permissions (typically a user who has sudo access).

  1. If AtScale is currently running, shut it down.

    $ /opt/atscale/bin/atscale_stop
  2. Remove any versions of AtScale that are not part of the backup being restored because they were installed after the backup was created. AtScale recommends removing old versions using the package manager that was used to install AtScale.

  3. Move the current installation of AtScale out /opt/atscale to clear space for the backup.

    $ mv /opt/atscale /opt/atscale.old
  4. Move the AtScale backup to /opt/atscale.

    $ mv /opt/atscale.bak /opt/atscale
  5. Once restored, you can AtScale. AtScale will now start with the backup acting as the current installation.

    $ /opt/atscale/bin/atscale_start

Backing up Clustered AtScale

Backing up clustered AtScale is similar to backing up stand-alone AtScale, the difference being that the nodes must be dealt with in a specific order.

The clustered AtScale backup procedure can only be performed on the node that is designated as the database Leader.

  1. Determine which node is the database Leader.

    $ /opt/atscale/current/bin/database/patronictl list
    +--------------------------+------------+------------------+--------+---------+----+----------+
    | Cluster | Member | Host | Role | State | TL | Lag in MB|
    +--------------------------+------------+------------------+--------+---------+----+----------+
    | atscale_postgres_cluster | atscale-01 | atscale-01:10520 | Leader | running | 1 | |
    +--------------------------+------------+------------------+--------+---------+----+----------+
    | atscale_postgres_cluster | atscale-02 | atscale-02:10520 | | running | 1 | |
    +--------------------------+------------+------------------+--------+---------+----+----------+
  2. On the node that is not the database Leader, shut AtScale down.

    $ /opt/atscale/bin/atscale_stop
  3. On the database Leader, remove any old AtScale versions that are no longer in use. AtScale recommends AtScale recommends removing old versions using the package manager that was used to install AtScale.

  4. Shut down AtScale on the database Leader in order to ensure a complete backup.

    $ /opt/atscale/bin/atscale_stop
  5. Perform the complete backup on the database Leader.

    $ cp -Rp /opt/atscale /opt/atscale.bak
  6. After the backup is complete, you can start AtScale again on the database Leader.

    $ /opt/atscale/bin/atscale_start
  7. Once the database Leader has been backed up and is running again, you can start AtScale on the node that is not the database Leader.

    $ /opt/atscale/bin/atscale_start

Restoring Clustered AtScale

Restoring clustered AtScale is similar to restoring stand-alone AtScale.

  1. On the node that does not contain the backup you are restoring, shut down AtScale.

    $ /opt/atscale/bin/atscale_stop
  2. On the same node, uninstall all AtScale versions and wipe clean the /opt/atscale directory. The preferred way of removing old versions is via the package manager that was used to install AtScale.

  3. On the node that does contain the backup, shut down AtScale.

    $ /opt/atscale/bin/atscale_stop
  4. On the Coordinator node, shut down AtScale.

    $ /opt/atscale/bin/atscale_stop
  5. Once AtScale is shut down, uninstall all AtScale versions and wipe clean the /opt/atscale directory on the Coordinator node. The preferred way of removing old versions is via the package manager that was used to install AtScale.

  6. On the Coordinator node, install the version of AtScale that you will be restoring from backup. The atscale.yaml configuration file should be the same one that's in the backup's conf directory.

  7. Once the Coordinator node is running, on the node that contains the backup, follow the process as laid out in Restoring Stand-Alone AtScale From a Backup.

  8. Once the restored node containing the backup is running, on the final node, install the version of AtScale that has been restored. The atscale.yaml configuration file should be the same one that's in the backup's conf directory.