-1

So I want to take pg_dump of postgresql running on pod(openshift). I was thinking to create a cron job which would ssh into postgresql pod and run the pg_dump command. But cronjob actually created it's own pod and execute the command in it's own pod. any idea how can we create a .bak file/take backup of postgresql whose terminal we cannot access.

Jonas
  • 121,568
  • 97
  • 310
  • 388
Charvee Punia
  • 423
  • 1
  • 6
  • 17
  • 2
    `pg_dump` is a client side program. You can run it from any computer that is able to connect to the database. –  Sep 17 '20 at 19:25

1 Answers1

1

thanks @a_horse_with_no_name, it worked. I created a dummy postgresql pod in dev namespace where I had access to terminal and executed the pg_dump command as follows pg_dump --username=username --host=host --port=port postgres > pguat.bak

it created the pguat.bak file. Restored it with following command to the new pgsql pod.

psql --username=username --host=host --port=port postgres < pguat.bak

Charvee Punia
  • 423
  • 1
  • 6
  • 17