Enable a backup schedule for a MAAS PostgreSQL database using Backupninja

Enable a backup schedule for a MAAS PostgreSQL database using BackupninjaΒΆ

This section describes how to create a backup schedule for a MAAS PostgreSQL database using the Backupninja utility. By default, Backupninja runs daily at 1.00 AM.

To create a backup schedule for a MAAS PostgreSQL database:

  1. Log in to the Salt Master node.

  2. Add the following lines to cluster/infra/maas.yml:

    classes:
    - system.backupninja.client.single
    - system.openssh.client.root
    parameters:
      _param:
        backupninja_backup_host: <IP>
        root_private_key: |
          <generate_your_keypair>
    

    Note

    The backupninja_backup_host parameter is the backupninja server that runs on any server, for example, on the Salt Master node.

  3. Include the following pillar to the node that runs the backupninja server and will store the database backups remotely:

    classes:
    - system.backupninja.server.single
    parameters:
      _param:
         backupninja_public_key: <generate_your_keypair>
    
  4. Optionally, override the default configuration of the backup schedule as described in Configure a backup schedule for a MAAS PostgreSQL database.

  5. Apply the salt.minion state:

    salt -C 'I@backupninja:client or I@backupninja:server' state.sls salt.minion
    
  6. Refresh grains for the backupninja client node:

    salt -C 'I@backupninja:client' saltutil.sync_grains
    
  7. Update the mine for the backupninja client node:

    salt -C 'I@backupninja:client' mine.flush
    salt -C 'I@backupninja:client' mine.update
    
  8. Apply the backupninja state on the backupninja client node:

    salt -C 'I@backupninja:client' state.sls backupninja
    

    Applying this state creates two backup configuration scripts. By default, the scripts are stored in the /etc/backup.d/ directory and will run daily at 1:00 AM.

  9. Refresh grains for the backupninja server node:

    salt -C 'I@backupninja:server' state.sls salt.minion.grains
    
  10. Apply the backupninja state on the backupninja server node:

    salt -C 'I@backupninja:server' state.sls backupninja