Skip to content

Commit

Permalink
Loadbalancer: Use balance => source for connection that have session.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Spredzy committed Aug 22, 2014
1 parent c06ec9c commit 1fcfb9b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
9 changes: 6 additions & 3 deletions manifests/loadbalancer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,13 @@
ip => $spice,
port => $spice_port,
options => {
'balance' => 'leastconn',
'mode' => 'tcp',
'option' => ['tcpka', 'tcplog', 'forwardfor'],
'balance' => 'source',
'timeout server' => '120m',
'timeout client' => '120m',
},
bind_options => $spice_bind_options,
httpchk => 'httpchk GET /';
}
cloud::loadbalancer::binding { 'trove_api_cluster':
ip => $trove_api,
Expand All @@ -387,7 +388,9 @@
cloud::loadbalancer::binding { 'glance_api_cluster':
ip => $glance_api,
options => {
'balance' => 'leastconn',
'mode' => 'tcp',
'balance' => 'source',
'option' => ['tcpka', 'tcplog', 'forwardfor'],
'timeout server' => '120m',
'timeout client' => '120m',
},
Expand Down
9 changes: 7 additions & 2 deletions manifests/loadbalancer/listen_http.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,20 @@

$options_basic = {'mode' => 'http',
'balance' => 'roundrobin',
'http-check' => 'expect ! rstatus ^5',
'option' => ['tcpka', 'forwardfor', 'tcplog', $httpchk] }

$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:
ipaddress => $listen_ip,
ports => $ports,
options => $options_custom,
options => $final_options,
bind_options => $bind_options,
}
}
8 changes: 3 additions & 5 deletions spec/classes/cloud_loadbalancer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,9 @@
:ipaddress => [params[:vip_public_ip]],
:ports => '6082',
:options => {
'mode' => 'http',
'option' => ['tcpka', 'forwardfor', 'tcplog','httpchk GET /'],
'http-check' => 'expect ! rstatus ^5',
'balance' => 'leastconn',
'mode' => 'tcp',
'balance' => 'source',
'option' => ['tcpka', 'tcplog', 'forwardfor'],
'timeout server' => '120m',
'timeout client' => '120m'
}
Expand Down Expand Up @@ -370,7 +369,6 @@
:ports => '443',
:options => {
'mode' => 'tcp',
'http-check' => 'expect ! rstatus ^5',
'option' => ['tcpka','forwardfor','tcplog', 'ssl-hello-chk'],
'cookie' => 'sessionid prefix',
'balance' => 'leastconn',
Expand Down

0 comments on commit 1fcfb9b

Please sign in to comment.