Although there are several ways to back up your systems, it is recommended that you back up your Salt infrastructure according to your Disaster Recovery policies.
There are several files that you must back up and transfer to your new RHEL 8/9 environment:
For more information on these files and directories, see Upgrading Tanzu Salt.
Use this command line as an example of how to backup your infrastructure. You can create three different state files for each specific node and apply these commands, respectively:
salt rhel9-raas state.sls raas-backup
salt rhel9-postgres state.sls pg-backup
salt rhel9-master state.sls master-backup
Note:
If you have a multi-node environment, then this state file needs to be split up to apply the appropriate stanza states to the node that contains the related files for that node.
# file: /srv/salt/backup.sls
copy_raas_config:
file.copy:
- name: /tmp/backup/raas
- source: /etc/raas/raas
- makedirs: True
- force: True
copy_raas_secconf:
file.copy:
- name: /tmp/backup/raas.secconf
- source: /etc/raas/raas.secconf
- force: True
- require:
- copy_raas_config
copy_raas_log:
file.copy:
- name: /tmp/backup/raas.log
- source: /var/log/raas
- force: True
- require:
- copy_raas_secconf
copy_raas_pki:
file.copy:
- name: /tmp/backup/pki
- source: /etc/raas/pki/
- makedirs: True
- force: True
- require:
- copy_raas_log
copy_raas_conf:
file.copy:
- name: /tmp/backup/master.d/raas.conf
- source: /etc/salt/master.d/raas.conf
- makedirs: True
- force: True
- require:
- copy_raas_pki
copy_eapimasterpaths:
file.copy:
- name: /tmp/backup/master.d/eAPIMasterPaths.conf
- source: /etc/salt/master.d/eAPIMasterPaths.conf
- makedirs: True
- force: True
- require:
- copy_raas_conf
copy_postgres_conf:
file.copy:
- name: /tmp/backup/postgresql.conf
- source: /var/lib/pgsql/12/data/postgresql.conf
- force: True
copy_pg_hba_conf:
file.copy:
- name: /tmp/backup/pg_hba.conf
- source: /var/lib/pgsql/12/data/pg_hba.conf
- force: True
You can backup the postgresql database using the command line as a postgres user.
To become the postgres user, run these commands:
su - postgres
Run the list command to display a list of databases to find the correct name of your database. The name of the postgresql data should be similar to: raas_43cab1f4de604ab185b51d883c5c5d09
in this example:
psql --list | grep -i raas
raas_43cab1f4de604ab185b51d883c5c5d09 | salt_eapi | UTF8 | en_US.utf8 | en_US.utf8 |
Create compressed gz file backup with this command.
pg_dump raas_43cab1f4de604ab185b51d883c5c5d09 | gzip >
raas_43cab1f4de604ab185b51d883c5c5d09.`date +%Y%m%d`.gz
Note:
This command creates a copy of your database in the currently working directory. Ensure you have enough space in the working directory to store this backup. See Recovering Disk Space for more information.
This gz file is used and imported to the Config Cloud Postgresql database by the VMware SRE team.