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 IP address or the host name of a node running the backupninja server. To obtain this IP address or host name, run salt -C 'I@backupninja:server' grains.item fqdn_ip4 or salt -C 'I@backupninja:server' grains.item fqdn respectively.

  3. Verify that root_private_key exists:

    salt-call pillar.get '_param:root_private_key'
    
  4. If the root_private_key parameter is missing, 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>
    
  5. Optionally, override the default configuration of the backup schedule as described in Configure a backup schedule for a MAAS PostgreSQL database.

  6. Apply the salt.minion state:

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

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

    salt -C 'I@backupninja:client' mine.update
    
  9. 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.

  10. Refresh grains for the backupninja server node:

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

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