HaProxy configuration to prevent multiple node writing with Percona Cluster

47 views
Skip to first unread message

Marc Castrovinci

unread,
Mar 23, 2015, 11:00:45 PM3/23/15
to percona-d...@googlegroups.com
So as recommended with Percona Cluster, we are (trying) to only write to one cluster node at a time. The application is using JDBC connection pooling. Whenever there is a flap in the service, it seems we end up with multiple nodes being written and then cluster deadlocks / local certification errors. We've improved this a little by changing our configuration to 'stick on dst' instead of 'stick on src'. 

Below is the configuration. Any suggestions? Should we not be using sticky sessions?

global
  log 127.0.0.1  local0
  maxconn 4960
  #debug
  #quiet
  user haproxy
  group haproxy
  stats socket /var/run/haproxy-stats uid haproxy mode 770
  stats maxconn 10
  noepoll

defaults
  log     global
  option  dontlognull
  retries 2
  option  redispatch
  maxconn 2000
  timeout connect 4s
  timeout client 1800s
  timeout server 1800s

peers hapeers
  peer xxxxxxx yyyyyy:1024
  peer aaaaaa bbbbbb:1024

frontend percona_cluster
  bind 0.0.0.0:3306
  default_backend percona_cluster

backend percona_cluster
  mode tcp
  option tcpka
  option tcplog
  option mysql-check
  stick-table type ip size 1 peers hapeers nopurge
  stick on dst
  server ec2-xxxxxxxxx.compute-1.amazonaws.com xxxxxxx:3306 maxconn 2500 check port 9200 inter 12000 rise 3 fall 3
  server ec2-xxxxxxxxx.compute-1.amazonaws.com xxxxxxx:3306 maxconn 2500 check port 9200 inter 12000 rise 3 fall 3
  server ec2-xxxxxxxxx.compute-1.amazonaws.com xxxxxxx:3306 maxconn 2500 check port 9200 inter 12000 rise 3 fall 3
  option httpchk OPTIONS * HTTP/1.1\r\nHost:\ www

  # set up application listeners configured via json
  listen ssl_cert
  bind 0.0.0.0:443 ssl crt /etc/haproxy/haproxy.pem no-sslv3
  balance roundrobin
  stick-table type ip size 200k peers hapeers expire 30m
  mode http
  stats enable
  stats scope .
  stats uri /haproxy-hp?stats

Reply all
Reply to author
Forward
0 new messages