Why does my Spilo PostgreSQL cluster keep falling apart in Docker Swarm?
Asked by
MellowPine42
I'm trying to run a basic highly available PostgreSQL cluster with Spilo images on a Docker Swarm setup, but every few days it starts failing in multiple ways: DNS resolution errors, connection timeouts, and corruption or inconsistency involving WAL data and etcd records. I can't afford a managed hosting solution right now. Has anyone experienced this kind of instability and found a reliable fix? It feels surprisingly difficult compared with setting up MariaDB with Galera, even though the goal seems fairly similar.
Answers
Iโve run the sample Spilo setup on a three-node cluster without seeing those failures. One important difference is that I avoided service DNS entirely and configured the nodes with fixed IP addresses through Ansible. That may be worth testing, since unstable name resolution can cause cascading problems for the cluster.
Reply to this answer
A PostgreSQL operator such as CloudNativePG on Kubernetes handles a lot of the discovery, failover, and recovery details for you, so it may be a more robust route if you can support that infrastructure.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowPine42: I understand the appeal, but taking on Kubernetes right now would be far more complexity than I want for this deployment. Iโm specifically trying to keep it within Docker Swarm.