Step 1: Perform a dump on the 5.3.0 VM.
tar
command must be installed on the VM.
(a) SSH to the 5.3.0 VM
(b) Save the migration script as migrate_postgres.sh.
(c) Provide the Execute Permissions
xxxxxxxxxx
chmod +x migrate_postgres.sh
(d) Declare environment variables
xxxxxxxxxx
source /opt/infoworks/bin/env.sh
(e) Run the script with the -d
flag.
xxxxxxxxxx
infoworks@vm-postgres:~$ ./migrate_postgres.sh -d
Taking Dump of Postgres
pg_dump installation not found trying in ${IW_HOME}/resources/postgres/pgsql/bin/pg_dump
Taking Postgres Dump - Enter the Parameters of the source PostgresDB Server
Input Postgres DNS / IP connection string for pg_dump
127.0.0.1
Input the Postgres Port for pg_dump. default: 5432
3008
Input postgresDB Username for pg_dump
infoworks-user
Input the Postgres user password for pg_dump
Input the database name of Postgres for pg_dump. default: airflow
airflow
This creates two files: pg_dump_data.sql (the PostgresDB Dump Data) and dags.tar.gz (the tar file containing the airflow dags)
Step 2: Deploy Infoworks 5.3.1 on K8s, giving the same MetaDB parameters as the VM and same PostgresDB parameters as provided in the previous step. For more information, refer to Infoworks Installation on Azure Kubernetes Service (AKS).
Step 3: Restore PostGres Data on any VM with connectivity to the PaaS Postgres.
psql
command must be installed on the VM.
(a) SSH to the VM.
(b) SCP the pg_dump_data.sql
file to the VM.
(c) Save the migration script as migrate_postgres.sh.
(d) Provide the execute permissions
xxxxxxxxxx
chmod +x migrate_postgres.sh
(e) Ensure the PostgresDB is empty before the following:
(f) Run the script with the -r
flag.
xxxxxxxxxx
infoworks@bastion-host:~$ ./migrate_postgres.sh -r
Restoring Dump of Postgres
Restoring - Enter the Parameters of the target PostgresDB Server
Input Postgres DNS / IP connection string for pg_restore
postgres-paas.postgres.database.azure.com
Input the Postgres Port for pg_restore. default: 5432
5432
Input postgresDB Username for pg_restore
infoworks
Input the Postgres user password for pg_restore
Input the database name of Postgres for pg_restore. default: airflow
upgrade_airflow
This restores the Postgres Data.
Step 4: Restore the dags data from the Bastion host (any VM with access to the Kubernetes API)
tar
command must be installed on the VM.
(a) SSH to VM.
(b) SCP the dags.tar.gz file onto the VM.
(c) untar the dags files.
xxxxxxxxxx
mkdir dags
tar xzf dags.tar.gz -C dags
(d) Get the list of pods on the Kubernetes deployment.
xxxxxxxxxx
kubectl -n <namespace> get pods
(e) Use Kubectl command cp
to copy the dag files to the PVC.
xxxxxxxxxx
kubectl -n <namespace> cp dags/*.py <orchestrator-pod-name>:/opt/infoworks/orchestrator-engine/dags/.
This copies the dags files to orchestrator PVC.