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:
Log in to the Salt Master node.
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.
Verify that root_private_key
exists:
salt-call pillar.get '_param:root_private_key'
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>
Optionally, override the default configuration of the backup schedule as described in Configure a backup schedule for a MAAS PostgreSQL database.
Apply the salt.minion
state:
salt -C 'I@backupninja:client or I@backupninja:server' state.sls salt.minion
Refresh grains for the backupninja
client node:
salt -C 'I@backupninja:client' saltutil.sync_grains
Update the mine for the backupninja
client node:
salt -C 'I@backupninja:client' mine.update
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.
Refresh grains for the backupninja
server node:
salt -C 'I@backupninja:server' state.sls salt.minion.grains
Apply the backupninja
state on the backupninja
server node:
salt -C 'I@backupninja:server' state.sls backupninja