Restore the MAAS PostgreSQL database using Backupninja

Restore the MAAS PostgreSQL database using Backupninja

Note

This feature is available starting from the MCP 2019.2.5 maintenance update. Before enabling the feature, follow the steps described in Apply maintenance updates.

You may need to restore a MAAS PostgreSQL database after a hardware or software failure or if you want to create a clone of the existing database from a backup. This section instructs you on how to run a restore of a MAAS PostgreSQL database using the Backupninja service.

To restore a MAAS PostgreSQL database using the Backupninja service:

Select one of the following options:

  • Restore the MAAS PostgreSQL database automatically as described in Restore the services using Backupninja pipeline.

  • Restore the MAAS PostgreSQL database manually:

    1. Log in to the Salt Master node.

    2. Include the following pillar to cluster/infra/maas.yml to restore the MAAS PostgreSQL database from any database node:

      classes:
      - system.maas.region.single
      - system.maas.region.restoredb
      parameters:
         _param:
           backupninja_backup_host: <IP>
      
    3. Apply the maas.region state to the corresponding nodes with MAAS:

      salt -C I@maas:region state.sls maas.region
      

      Running this state restores the databases and creates a file for every restored database in /root/maas/flags.

      Caution

      If you rerun the state, it will not restore the database again. To repeat the restore procedure for any database, first delete the database file from /root/maas/flags and then rerun the maas.region state again.