0

I have a kubernetes cluster and I have configured a statefulset with two replicas (lets say postgres-0 and postgres-1), one will be active and another will be standby for a perticular time. Now I want to run pg_dumpall from postgres-1 to connect to postgres-0 by specifying certificates (which I already created). I am able to dump a particular database using :

pg_dump "port=5432 host=10.20.30.40 user=postgres dbname=test sslcert=pg.cert.pem sslkey=pg.key.pem sslrootcert=ca.crt sslmode=verify-ca" -f test.sql

I need to do the same with pg_dumpall. Is there any to do that? Ref: https://www.postgresql.org/docs/9.2/app-pg-dumpall.html

Soumyajit
  • 329
  • 1
  • 5
  • 16

1 Answers1

1

Sure, but you have to use the connect string as an argument to the -d option:

pg_dumpall -d 'host=... port=... ...' -f test.sql
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
  • And I to restore I am using pg_restore, there -d option represents db name. So what will be the option for connection string in this? – Soumyajit Jan 23 '20 at 13:25
  • 1
    This is a plain text dump, and you restor it with `psql`. You can use the `-d` option to pass a connect string. – Laurenz Albe Jan 23 '20 at 13:32