kostiantyn-nemchenko / ansible-role-patroni

:elephant: Ansible Role for Patroni
https://galaxy.ansible.com/kostiantyn-nemchenko/patroni
MIT License
68 stars 44 forks source link

How to generate haproxy configuration using patronictl #45

Closed varmaraju closed 5 years ago

varmaraju commented 5 years ago

Hi Sir,

We have successfully installed the patroni, its working fine as expected. We are planning to generate HAPROXY configuration using patroni, when I have checked only below commands available

NOTE: Patroni provides an HAProxy configuration, which will give your application a single endpoint for connecting to the cluster’s leader

Commands: configure Create configuration file dsn Generate a dsn for the provided member, defaults to a dsn of... edit-config Edit cluster configuration failover Failover to a replica flush Flush scheduled events list List the Patroni members for a given Patroni pause Disable auto failover query Query a Patroni PostgreSQL member reinit Reinitialize cluster member reload Reload cluster member configuration remove Remove cluster from DCS restart Restart cluster member resume Resume auto failover scaffold Create a structure for the cluster in DCS show-config Show cluster configuration switchover Switchover to a replica version Output version of patronictl command or a running Patroni...

when I checked configuration command like below, even this command also not able to find regarding HAPROXY .

patronictl configure

Configuration file [/root/.config/patroni/patronictl.yaml]: DCS connect url [etcd://localhost:2379]: Namespace [/service/]:

Can you please guid me how to generate haproxy configuration using patroni.

kostiantyn-nemchenko commented 5 years ago

Hi, @varmaraju You cannot find anything about haproxy in patronictl help, because configuring of proxies is simply not supported and there is no need to do so. You can use haproxy, pgbouncer, kubernetes service, cloud load balancers etc to implement routing of read/write queries to a specific patroni node. Obviously, patroni can not support all kinds of proxies but provides enough flexibility and you need to figure out what is better for you. If you are looking for a working haproxy config example, you may find it here