Answer the question
In order to leave comments, you need to log in
How to configure Pgpool to route read requests on replica and master 50:50?
Good afternoon, a task appeared by way of a pg-pool:
The pgpool bundle goes to haproxy, and haproxy to the cluster in patroni (1 master, 2 slaves). Pgpool does not see the cluster directly.
1. divide read and write requests between the master database and the replica, approximately 50:50.
2. set up balancing of requests for reading master and replica (to different haproxy endpoints)
3. Failover automatic reconnection of a disconnected haproxy endpoint.
Haproxy + pgpool are on the same machine.
Ports used on endpoints 5000 and 5001. If haproxy returns an error to pgpool, then pgpool kicks this node out of the cluster and gives the master role to another, until the failed node resumes.
Smoked a bunch of manuals, can you give me a direction?
backend_hostname0 = 'localhost'
backend_port0 = 5000
backend_weight0 = 1 here the weight is indicated that we accept 100% of requests, just like in the example below, therefore the balancing is somewhere around 50/50%.
backend_data_directory0 = '/var/lib/pgsql/data'
backend_flag0 = 'ALLOW_TO_FAILOVER'
backend_hostname1 = 'localhost'
backend_port1 = 5001
backend_weight1 = 1
backend_data_directory1 = '/var/lib/pgsql/data'
backend_flag1 = 'ALLOW_TO_FAILOVER'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question