From fa8f1f7746bf639f73d09964e482bd7847180d1d Mon Sep 17 00:00:00 2001 From: Jerzy Mikolajczak Date: Wed, 1 Jun 2016 12:23:17 +0200 Subject: [PATCH] Add fallback prevention to mysql in haproxy config Using sticky-table + stick on dst prevents fallback to active node in scenario where it comes back from being down. This may lead to sql connections from openstack services to different mysql nodes. This patch also removes hash-type and balance option as stickiness is being done with sticky-table. Change-Id: Ibc2fb4fa5a1938aec447694638c4c9e99edbba53 Closes-bug: #1529937 --- deployment/puppet/openstack/manifests/ha/mysqld.pp | 6 +++--- .../openstack-haproxy/openstack-haproxy-mysqld_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deployment/puppet/openstack/manifests/ha/mysqld.pp b/deployment/puppet/openstack/manifests/ha/mysqld.pp index 82d7f8421a..573eac66e4 100644 --- a/deployment/puppet/openstack/manifests/ha/mysqld.pp +++ b/deployment/puppet/openstack/manifests/ha/mysqld.pp @@ -50,12 +50,12 @@ class openstack::ha::mysqld ( balancermember_port => 3307, define_backups => true, haproxy_config_options => { - 'hash-type' => 'consistent', 'option' => ['httpchk', 'tcplog','clitcpka','srvtcpka'], - 'balance' => 'source', 'mode' => 'tcp', 'timeout server' => '28801s', - 'timeout client' => '28801s' + 'timeout client' => '28801s', + 'stick-table' => 'type ip size 1', + 'stick on' => 'dst' }, balancermember_options => 'check port 49000 inter 20s fastinter 2s downinter 2s rise 3 fall 3', } diff --git a/tests/noop/spec/hosts/openstack-haproxy/openstack-haproxy-mysqld_spec.rb b/tests/noop/spec/hosts/openstack-haproxy/openstack-haproxy-mysqld_spec.rb index 5dcebeda56..6ce636c2d9 100644 --- a/tests/noop/spec/hosts/openstack-haproxy/openstack-haproxy-mysqld_spec.rb +++ b/tests/noop/spec/hosts/openstack-haproxy/openstack-haproxy-mysqld_spec.rb @@ -40,12 +40,12 @@ describe manifest do 'balancermember_port' => 3307, 'define_backups' => true, 'haproxy_config_options' => { - 'hash-type' => 'consistent', 'option' => ['httpchk', 'tcplog','clitcpka','srvtcpka'], - 'balance' => 'source', 'mode' => 'tcp', 'timeout server' => '28801s', - 'timeout client' => '28801s' + 'timeout client' => '28801s', + 'stick-table' => 'type ip size 1', + 'stick on' => 'dst' }, 'balancermember_options' => 'check port 49000 inter 20s fastinter 2s downinter 2s rise 3 fall 3',