Implement sticky/persistent session with HAProxy
This commit implements sticky/persisten session between HAProxy and Horizon based on the leastconn fashion Related to #237 (cherry picked from commit 1a64e535b7f1a13c6ccd6388a0c95131a91f77eb) Conflicts: manifests/loadbalancer.pp
This commit is contained in:
committed by
Emilien Macchi
parent
8e769da415
commit
35d99d0c81
@@ -138,7 +138,7 @@ class cloud::dashboard(
|
||||
server_names => $::hostname,
|
||||
ipaddresses => $api_eth,
|
||||
ports => $horizon_port,
|
||||
options => 'check inter 2000 rise 2 fall 5'
|
||||
options => "check inter 2000 rise 2 fall 5 cookie ${::hostname}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -522,6 +522,7 @@ class cloud::loadbalancer(
|
||||
'horizon_cluster':
|
||||
ports => $horizon_port,
|
||||
httpchk => "httpchk GET / HTTP/1.0\r\nUser-Agent:\ ${::hostname}",
|
||||
options => {'cookie' => 'sessionid prefix', 'balance' => 'leastconn' },
|
||||
listen_ip => $vip_public_ip;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,16 +20,19 @@
|
||||
define cloud::loadbalancer::listen_http(
|
||||
$ports = 'unset',
|
||||
$httpchk = 'httpchk',
|
||||
$options = {},
|
||||
$listen_ip = '0.0.0.0') {
|
||||
|
||||
$options_basic = {'mode' => 'http',
|
||||
'balance' => 'roundrobin',
|
||||
'http-check' => 'expect ! rstatus ^5',
|
||||
'option' => ['tcpka', 'tcplog', $httpchk] }
|
||||
|
||||
$options_custom = merge($options_basic, $options)
|
||||
|
||||
haproxy::listen { $name:
|
||||
ipaddress => $listen_ip,
|
||||
ports => $ports,
|
||||
options => {
|
||||
'mode' => 'http',
|
||||
'balance' => 'roundrobin',
|
||||
'option' => ['tcpka', 'tcplog', $httpchk],
|
||||
'http-check' => 'expect ! rstatus ^5',
|
||||
}
|
||||
options => $options_custom,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user