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
Sure, but you have to use the connect string as an argument to the -d
option:
pg_dumpall -d 'host=... port=... ...' -f test.sql