are connections to Database http based or tcp based.
Are jdbc of spring-boot application to postgressql http method connections based or tcp based connections.
are connections to Database http based or tcp based.
Are jdbc of spring-boot application to postgressql http method connections based or tcp based connections.
How to setup/make Haproxy send read-write request coming on same port 5432 from application, to backend servers of postgres-patroni cluster based on REST method.
I have three node postgres-patroni cluster running as docker service/containers behind Haproxy. I wanna sent read/get request coming from my-application on port 5432 to relicas of my cluster and sent write/(Delete|Post|Update) request coming from my-application also on port 5432 to master server.
I have tried to achieve it with below config. But didn't succeed as of now.
Any idea How to make Haproxy achieve above scenario.
Here is my Haproxy.cfg file
global
maxconn 100
defaults
log global
mode tcp
retries 2
timeout client 30m
timeout connect 4s
timeout server 30m
timeout check 5s
# never fail on address resolution
default-server init-addr none
resolvers docker_resolver
nameserver dns 127.0.0.11:53
listen stats
mode http
bind *:7000
stats enable
stats uri /
frontend master_postgresql
bind *:5432
acl is_post method "POST|UPDATE|DELETE"
use_backend backend_master if is_post
default_backend backend_master
frontend replicas_postgresql
bind *:5432
acl is_get method GET
use_backend backend_replicas if is_get
default_backend backend_replicas
frontend patroni_api
bind *:8008
default_backend backend_api
backend backend_master
balance source
hash-type consistent
option httpchk OPTIONS /master
server postgres1 postgres1:5432 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4
server postgres2 postgres2:5432 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4
server postgres3 postgres3:5432 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4
backend backend_replicas
option httpchk OPTIONS /replica
server postgres1 postgres1:5432 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4
server postgres2 postgres2:5432 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4
server postgres3 postgres3:5432 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4
backend backend_api
option httpchk OPTIONS /master
server postgres1 postgres1:8008 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4
server postgres2 postgres2:8008 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4
server postgres3 postgres3:8008 maxconn 100 check port 8008 resolvers docker_resolver resolve-prefer ipv4