How to backup/restore MAAS when it runs in SNAP?
MAAS version: 2.7.0
Thanks.
Data for the snap itself can be backed up using snap backups:
sudo snap save maas
will create a backup (and print out its ID). If the snap is configured in all
mode, this will include database as well.
The command should be run with MAAS stopped to avoid database inconsistencies.
The backup can be restored with
sudo snap restore maas <id>
using the id
returned by the previous comand (it can also be found with snap saved
).
You can also backup the PostgreSQL database from the snap with the following command (which must be run with MAAS running):
export PGPASS=$(sudo cat /var/snap/maas/current/regiond.conf | sed -n 's/database_pass: \(.*\)/\1/p')
sudo pg_dump -U maas -h /var/snap/maas/common/postgres/sockets -d maasdb > maasdb.sql
If you’re running PostgreSQL outside of the snap (which is suggesed for production setups), you can run a similar pg_dump
command replacing the -h
option with the hostname/address of you PostgreSQL server.
1 Like