Loadbalancer: Use balance => source for connection that have session.

In order to avoid the Connection Reset By Peer error, (ie. #561),
we use balancer => source for every connection that involves session.

Currently, spice_cluster and glance_api_cluster.
This commit is contained in:
Yanis Guenane 2014-08-21 10:40:29 -04:00
parent c06ec9cdbd
commit 1fcfb9b567
3 changed files with 16 additions and 10 deletions

View File

@ -372,12 +372,13 @@ class cloud::loadbalancer(
ip => $spice, ip => $spice,
port => $spice_port, port => $spice_port,
options => { options => {
'balance' => 'leastconn', 'mode' => 'tcp',
'option' => ['tcpka', 'tcplog', 'forwardfor'],
'balance' => 'source',
'timeout server' => '120m', 'timeout server' => '120m',
'timeout client' => '120m', 'timeout client' => '120m',
}, },
bind_options => $spice_bind_options, bind_options => $spice_bind_options,
httpchk => 'httpchk GET /';
} }
cloud::loadbalancer::binding { 'trove_api_cluster': cloud::loadbalancer::binding { 'trove_api_cluster':
ip => $trove_api, ip => $trove_api,
@ -387,7 +388,9 @@ class cloud::loadbalancer(
cloud::loadbalancer::binding { 'glance_api_cluster': cloud::loadbalancer::binding { 'glance_api_cluster':
ip => $glance_api, ip => $glance_api,
options => { options => {
'balance' => 'leastconn', 'mode' => 'tcp',
'balance' => 'source',
'option' => ['tcpka', 'tcplog', 'forwardfor'],
'timeout server' => '120m', 'timeout server' => '120m',
'timeout client' => '120m', 'timeout client' => '120m',
}, },

View File

@ -26,15 +26,20 @@ define cloud::loadbalancer::listen_http(
$options_basic = {'mode' => 'http', $options_basic = {'mode' => 'http',
'balance' => 'roundrobin', 'balance' => 'roundrobin',
'http-check' => 'expect ! rstatus ^5',
'option' => ['tcpka', 'forwardfor', 'tcplog', $httpchk] } 'option' => ['tcpka', 'forwardfor', 'tcplog', $httpchk] }
$options_custom = merge($options_basic, $options) $options_custom = merge($options_basic, $options)
if $options_custom['mode'] == 'http' {
$final_options = merge($options_custom, { 'http-check' => 'expect ! rstatus ^5' })
} else {
$final_options = $options_custom
}
haproxy::listen { $name: haproxy::listen { $name:
ipaddress => $listen_ip, ipaddress => $listen_ip,
ports => $ports, ports => $ports,
options => $options_custom, options => $final_options,
bind_options => $bind_options, bind_options => $bind_options,
} }
} }

View File

@ -209,10 +209,9 @@ describe 'cloud::loadbalancer' do
:ipaddress => [params[:vip_public_ip]], :ipaddress => [params[:vip_public_ip]],
:ports => '6082', :ports => '6082',
:options => { :options => {
'mode' => 'http', 'mode' => 'tcp',
'option' => ['tcpka', 'forwardfor', 'tcplog','httpchk GET /'], 'balance' => 'source',
'http-check' => 'expect ! rstatus ^5', 'option' => ['tcpka', 'tcplog', 'forwardfor'],
'balance' => 'leastconn',
'timeout server' => '120m', 'timeout server' => '120m',
'timeout client' => '120m' 'timeout client' => '120m'
} }
@ -370,7 +369,6 @@ describe 'cloud::loadbalancer' do
:ports => '443', :ports => '443',
:options => { :options => {
'mode' => 'tcp', 'mode' => 'tcp',
'http-check' => 'expect ! rstatus ^5',
'option' => ['tcpka','forwardfor','tcplog', 'ssl-hello-chk'], 'option' => ['tcpka','forwardfor','tcplog', 'ssl-hello-chk'],
'cookie' => 'sessionid prefix', 'cookie' => 'sessionid prefix',
'balance' => 'leastconn', 'balance' => 'leastconn',