Skip to content

Commit

Permalink
upgrade: haproxy: enable direct connections apart from pgbouncer ones (
Browse files Browse the repository at this point in the history
  • Loading branch information
jimnydev committed Jan 10, 2024
1 parent 65bfda3 commit e3ebd5f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions roles/upgrade/templates/haproxy-no-http-checks.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,30 @@ listen replicas_async
{% for host in groups['secondary'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['inventory_hostname'] }}:{{ pgbouncer_listen_port }}
{% endfor %}

{% if with_haproxy_direct_connections|bool %}
listen master_direct
{% if cluster_vip is defined and cluster_vip | length > 0 %}
bind {{ cluster_vip }}:{{ haproxy_listen_port.master_direct }}
{% else %}
bind {{ hostvars[inventory_hostname]['inventory_hostname'] }}:{{ haproxy_listen_port.master_direct }}
{% endif %}
maxconn {{ haproxy_maxconn.master }}
option tcplog
{% for host in groups['primary'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['inventory_hostname'] }}:{{ postgresql_port }}
{% endfor %}

listen replicas_direct
{% if cluster_vip is defined and cluster_vip | length > 0 %}
bind {{ cluster_vip }}:{{ haproxy_listen_port.replicas_direct }}
{% else %}
bind {{ hostvars[inventory_hostname]['inventory_hostname'] }}:{{ haproxy_listen_port.replicas_direct }}
{% endif %}
maxconn {{ haproxy_maxconn.replica }}
option tcplog
balance roundrobin
{% for host in groups['secondary'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['inventory_hostname'] }}:{{ postgresql_port }}
{% endfor %}
{% endif %}

0 comments on commit e3ebd5f

Please sign in to comment.