Step 3 – Create a Dump/Backup of Postgres Data
Note
If using an externally hosted Postgres database (Amazon RDS, for example), you can skip the steps that involve dumping and restoring the Postgres data. It is assumed that during the 7.0 installation, the externally hosted Postgres DB was used to configure the 7.0 system.
Otherwise, this is the step where we need to create the dump of Postgres data from the old database so it can be loaded into the new database in a later step.
Prior to performing the Postgres dump, shut down the 6.x application services (app and analytics) to prevent new data from being added to the DB.
# find running processes
systemctl --type=service --state=running
# start shutting them down
sudo systemctl stop brainspace-platform
sudo systemctl stop brainspace-haproxy
# analytics and on-demand analytics
sudo systemctl stop brainspace-analysis
Perform a dump of the Postgres DB (Postgres needs to be running) on the 6.x database host:
PGPASSWORD=<Postgres Password> pg_dump -U brainspace -f brainspace6-db.sql brainspace
Alternatively, you can omit the password variable and enter the password interactively, or you can switch to the Postgres user prior to running the pg_dump command and you won’t need to provide a password at all.
su - postgres
pg_dump -U brainspace -f brainspace6-db.sql brainspace
Now is a good time to shut down the Postgres DB in the 6.x environment:
sudo systemctl stop postgresql-13