Closed jimnydev closed 4 months ago
listen master
bind 10.172.0.20:5000
maxconn 10000
option tcplog
option httpchk OPTIONS /primary
http-check expect status 200
default-server inter 3s fastinter 1s fall 3 rise 4 on-marked-down shutdown-sessions
server pgnode01 10.172.0.20:6432 check port 8008
server pgnode02 10.172.0.21:6432 check port 8008
server pgnode03 10.172.0.22:6432 check port 8008
listen master_direct
bind 10.172.0.20:6000
maxconn 10000
option tcplog
option httpchk OPTIONS /primary
http-check expect status 200
default-server inter 3s fastinter 1s fall 3 rise 4 on-marked-down shutdown-sessions
server pgnode01 10.172.0.20:5432 check port 8008
server pgnode02 10.172.0.21:5432 check port 8008
server pgnode03 10.172.0.22:5432 check port 8008
listen replicas
bind 10.172.0.20:5001
maxconn 10000
option tcplog
option httpchk OPTIONS /replica
balance roundrobin
http-check expect status 200
default-server inter 3s fastinter 1s fall 3 rise 2 on-marked-down shutdown-sessions
server pgnode01 10.172.0.20:6432 check port 8008
server pgnode02 10.172.0.21:6432 check port 8008
server pgnode03 10.172.0.22:6432 check port 8008
listen replicas_direct
bind 10.172.0.20:6001
maxconn 10000
option tcplog
option httpchk OPTIONS /replica
balance roundrobin
http-check expect status 200
default-server inter 3s fastinter 1s fall 3 rise 2 on-marked-down shutdown-sessions
server pgnode01 10.172.0.20:5432 check port 8008
server pgnode02 10.172.0.21:5432 check port 8008
server pgnode03 10.172.0.22:5432 check port 8008
root@pgnode01:/# systemctl stop pgbouncer
root@pgnode01:/# systemctl stop pgbouncer-2
root@pgnode01:/# psql -h 10.172.0.20 -p 5000 -U postgres
^C
root@pgnode01:/# psql -h 10.172.0.20 -p 6000 -U postgres
Password for user postgres:
psql (16.1 (Ubuntu 16.1-1.pgdg22.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type "help" for help.
postgres=# \q
root@pgnode01:/# psql -h 10.172.0.20 -p 6001 -U postgres
Password for user postgres:
psql (16.1 (Ubuntu 16.1-1.pgdg22.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type "help" for help.
postgres=# \q
passed
This is a tackle at #548
It's a draft, just to double check with you if you'd go this way (say, variable names). I'm not sure if we should provide a direct connections to individual replicas (so I've just provided a generic one, initially).
Also, HAProxy config is added at the end of existing stuff. I can split it so that
master
andreplicas
are grouped within existing previous sections (although it would duplicate the check if it should be included).Thanks!