Postgres Questions

So if I have a Postgres cluster in dev mode (single node), and I clone it into two regions:

  1. Will those new machines be read only and
  2. Will those new machines scale to zero

Yes, any machines in other regions will come up with ROLE=replica. (This is for PG Flex, at least—not sure about the older Stolon variety.)

$ fly status
ID              STATE    ROLE     REGION  IMAGE
b915aabbaa0453  started  primary  ewr     flyio/postgres-flex:15.3
abcd091290fedc  started  replica  bos     flyio/postgres-flex:15.3

This part I would shy away from… The metadata for that does get preserved by clone, but stopped replicas will cause WALs to accumulate back on the primary, as I understand it:

https://community.fly.io/t/runaway-pg-wal-disk-usage/17438/2

When dabbling in the past, I did eventually see…

Warning: Inactive replication slot repmgr_slot_1545901680 is retaining 283 MB of WAL

And the size of /data/postgresql/pg_wal/ really was increasing (until the replica was hastily brought back online).

Ok good to know. I don’t really want to have them scale to 0, but I was curious how that worked since with “regular” machines I just set minimum machines to 1, and the other regions scale down. I didn’t know what happened for the PG instances behind the scene.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.