Elixir/Phoenix + Postgres, fault-tolerant together?

There is a lot of information available in splitting your application in one or multiple OTP applications, which can be deployed in a distributed fashion, as to perform failover/takeover when one of the systems breaks down (And the app as a whould could still be usable by using the Border Gateway Protocol to have these multiple servers listen on the same IP address).

However, in an application where data is stored in a Postgres database, I’d like the data stored there to also remain available when one of the servers goes down.
I know that Postgres contains some tools to allow the replication and sharding of data, but no specifics. I am wondering what would be the best way to configure Postgres to ensure that data remains available when one of the servers (temporarily) goes down.

Is there anyone who would like to share some insights on this?

There are multiple styles of PostgreSQL replication, have you looked at any of them to start? Do you prefer to replicate commands (rows might be in different orders in different ones, but is faster and more reliable), or do you prefer to replicate binary (all databases remain in perfect sync, but if one gets corrupted then that corruption can also replicate out ^.^;).

1 Like