Run multiple replicas with synchronous replication. For Postgres see:
https://wiki.postgresql.org/wiki/Synchronous_replication
This way you should be able to tolerate failure of a single instance without losing data.
https://wiki.postgresql.org/wiki/Synchronous_replication
This way you should be able to tolerate failure of a single instance without losing data.
of course, if a comet hits the master db server, you might lose a tiny bit data (typically 0.1 seconds) if not using sync replication.
you can use sync replication for the important things that you absolutely can't lose, and async replication for everything else.