Deploy PostgreSQL HA (Patroni, etcd, HAproxy) on Ubuntu servers using Ansible

Published on Author admin

Deploy PostgreSQL HA (Patroni, etcd, HAproxy) on Ubuntu servers using Ansible Architecture Verify commands #etcd etcdctl --endpoints=http://10.10.10.111:2379,http://10.10.10.112:2379,http://10.10.10.113:2379 member list etcdctl --endpoints=http://10.10.10.111:2379,http://10.10.10.112:2379,http://10.10.10.113:2379 endpoint health etcdctl --endpoints=http://10.10.10.111:2379,http://10.10.10.112:2379,http://10.10.10.113:2379 endpoint status #patroni patronictl -c /etc/patroni/patroni.yml topology ls /var/lib/postgresql/18/main -l /usr/lib/postgresql/18/bin/pg_controldata /var/lib/postgresql/18/main #haproxy watch 'echo "show stat" | nc -U /var/lib/haproxy/stats | cut -d "," -f 1,2,5-11,18,24,27,30,36,50,37,56,57,62 | column -s,… Continue reading Deploy PostgreSQL HA (Patroni, etcd, HAproxy) on Ubuntu servers using Ansible

Generic HA Architecture - App servers + PostgreSQL Patroni cluster

Published on Author admin

Generic HA Architecture - App servers + PostgreSQL Patroni cluster Keepalived + HAproxy used as Load Balancers   Key components: HAproxy - TCP/HTTP Load Balancer Keepalived - Virtual IP for HAproxy Patroni - HA template for PostgreSQL database (cluster with streaming replication) etcd - Distributed Configuration Store for Patroni   Architecture diagram:

Port forwarding using HAproxy

Published on Author admin

HAproxy can be used not only for complex load-balancing scenarios, but also for simple port forwarding. Useful for forwarding packets originating from both local and external hosts. listen postgresql 0.0.0.0:5432     mode tcp     stats enable     balance roundrobin     server postgresql-db 192.168.0.1:5432 check