Database Migration from Bitnami to Percona

This section explains how to migrate the pgvector database from a Bitnami PostgreSQL installation to a Percona PostgreSQL installation.

Backing Up and Restoring the pgvector Database

Set Environment Variables
export NS=<namespace>
export RL=<release-name>

Old Installation (Bitnami)

  1. Port-forward the pgvector service
    kubectl -n $NS port-forward svc/$RL-pgvector 5432:5432
  2. Get the database password
    kubectl -n $NS get secret $RL-postgres-password-secret -o jsonpath="{.data.postgres-password}" | base64 --decode
  3. Dump the database
    pg_dump -U postgres -h localhost -p 5432 --data-only --disable-triggers agenticbuilder > backup.sql

New Installation (Percona)

  1. Port-forward the database pod
    
    kubectl port-forward -n $NS \
      $(kubectl get pod -l postgres-operator.crunchydata.com/cluster=$RL-pg-db -n $NS -o jsonpath="{.items[0].metadata.name}") \
      5432:5432
  2. Get the database user and password
    
    # Get user
    export PGUSER=$(kubectl -n $NS get secret $RL-pg-db-pguser-postgres -o jsonpath="{.data.user}" | base64 -d)
    
    # Get password
    kubectl -n $NS get secret $RL-pg-db-pguser-postgres -o jsonpath="{.data.password}" | base64 -d
    
  3. Restore the database
    psql -d agenticbuilder -U $PGUSER -h localhost -p 5432 -f backup.sql