How to export database from VCF Automation 9.x
search cancel

How to export database from VCF Automation 9.x

book

Article ID: 425665

calendar_today

Updated On:

Products

VCF Automation

Issue/Introduction

Collecting and providing databases to Broadcom support in certain scenario's will assist in faster resolution

The steps provided in the article will assist in collecting either the entire database or a specific database

Environment

VCF Automation 9.x

Resolution

SSH into one of the nodes.


# It does not matter which one.

ssh vmware-system-user@<node ip>


Step 1: Set KUBECONFIG and retrieve the credentials 

export KUBECONFIG=/etc/kubernetes/admin.conf

# Get username (example for catalog_db owner)

kubectl get secret catalog-db-owner-user.vcfapostgres.credentials.postgresql.acid.zalan.do -n prelude -o jsonpath='{.data.username}' | base64 -d

# Get password

kubectl get secret catalog-db-owner-user.vcfapostgres.credentials.postgresql.acid.zalan.do -n prelude -o jsonpath='{.data.password}' | base64 -d


Step 2: Identify Primary Pod

# Identify the primary pod

export PRIMARY_POD=$(kubectl get pods -n prelude -l application=spilo,spilo-role=master -n prelude -o jsonpath='{.items[0].metadata.name}')
echo "Using primary pod: $PRIMARY_POD"


Step 3: Backup a single Database

# Backup a specific database (e.g., catalog_db)

kubectl exec $PRIMARY_POD -n prelude -c postgres -- \
  pg_dump -U postgres -d catalog_db --format=custom --compress=9 \
  > /tmp/catalog_db_backup_$(date +%Y%m%d_%H%M%S).dump