Starting/stopping a Postgres cluster when an autoscaling is called

I’ve got a few Postgres clusters, and they’re getting a bit expensive to run. I also have associated Spring Boot (native image) apps scaling from zero. They connect to the Postgres cluster.

I was wondering if it’s possible to scale from zero for the Postgres cluster. My Spring Boot apps will try and connect to Postgres on an exponential backoff, but I wanted to save on costs. I could just use one Postgres node, but I’d like to ensure data redundancy.

Thanks!

Hi Dom,

We don’t really support a configuration like you’re describing. If you want a single node Fly PG Machine to autostop, that’s supported; here’s the guide. And you can run Fly PG nodes in a cluster, as it sounds you’re doing now.

What you can’t do is run a clustered config that autostops. I hope you don’t mind my saying so, but that’s a bit of a contradiction in terms. The point of a DB cluster is to keep all nodes online to replicate changes across the cluster as fast as possible, and have standby nodes ready to take over if the primary ever fails. If the nodes in a cluster are stopped, then you don’t really have a cluster any more. The question of data replication now no longer looks like live replication, but a more generic backup question, to which there is no single good answer.

So if you want to use autostopping, I’d suggest running just a single Fly PG Machine, then think about what data guarantees you’re looking for, and come up with a backup solution that works for your design.

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