Patroni PostgreSQL - Cluster Setup

preview_player
Показать описание
In this video I am showing you how to setup PostgreSQL HA cluster with Patroni, we are using HA proxy as a load-balancer and etcd is our "witness"

Рекомендации по теме
Комментарии
Автор

Added a small change to the ha proxy configuration:

frontend patroni-prod
mode tcp
maxconn 5000
bind *:5432
default_backend patroni_servers


backend patroni_servers
mode tcp
option httpchk
http-check expect status 200
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions

server node1 10.10.0.181:5432 maxconn 100 check port 8008
server node2 10.10.0.182:5432 maxconn 100 check port 8008

This will allow you to talk to the databases by HA-PROXY-IP:5432, this means that applications would use the load-balancer IP to reach the databases. If not prefred then just use
psql -U postgres -h load-balancer-ip -p 5000

dem_linux
Автор

Beautiful explanation,
Thank you sir.

pritojf
Автор

to make things even better you can add pgbouncer to optimize connections

funkiam
Автор

Hi dear, do I have to create these users admin, postgres and replicator manually or should Patron create it automatically?
When I start Patroni on Ubuntu 22.04 .

innlinellc
Автор

Hi, can you post a video on how to configure patroni with the citus database? I am having hard time setting it up with citus database.

Thank you.

meetvora
Автор

Hi, that guy. According to FHS, the /mnt directory is reserved for temporarily mounted file systems. You shouldn't be configuring databases there. /srv, /var /mypatronidb are all better choices. As for the insecure md5 algorithm, it's been ditched by Postgres and defaults to scram-sha-256, starting from v14 you use in this video. You can just change that in your configs and all will work.

barkleybarkleyy
Автор

How do we ensure our connections through HAProxy are not failing in case the HAProxy (Node4) goes down? Is there a way we can setup HA for HAProxy loadbalancing ?

yashkotari
Автор

my leader node and replica node are not syncing .Can you please help

reuyeid
Автор

thank you very much but i have a question, can i use one server for etcd and ha proxy, i see your use 4 servers ..

emanfeah
Автор

your tutorial is helpful for me, but can you show me how to access that cluster (node1 & node2) via node-etcd? so my apps just only need to access node-etcd ip to connect that clustered database

wahyucandratama
Автор

is that patroni.yml in node1 are same on node2?

wahyucandratama
Автор

authentication:
replication:
username: replicator
password: password
superuser:
username: postgres
password: password
Here, should I create this user & password manually after install postgres on all node?Is there any other configuration needed on postgres node?

panthajan
Автор

patroni cluster has no leader and it show like

I'm setting up a Patroni cluster and facing an issue where both nodes remain in the 'stopped' state, and the logs indicate that the system is waiting for a leader to bootstrap. Here is the output when I run patronictl -c /etc/postgres0.yml list:

Cluster: postgres
| Member | Host | Role | State | TL | Lag in MB |

| postgresql0 | xxx.xxx.xx.57 | Replica | stopped | | unknown |
| postgresql1 | xxx.xxx.xx.129 | Replica | stopped | | unknown |


Kindly help me to solve this issue

khansaif
Автор

I do the same you but aways meet error >> CRITICAL: system ID mismatch, node patrono-node2 belongs to a different cluster: 7396713246569953512 != 7396707261106546582

codefunc-kythuatlaptrinh