Commit 1b6743ab authored by Bernd Zeimetz's avatar Bernd Zeimetz
Browse files

make rw node backup for ro

parent 8e31ef5e
......@@ -62,6 +62,7 @@ class percona(
$haproxy_readonly_frontend_bind = { "${wsrep_node_address}::3307" => [] },
$haproxy_readwrite_frontend_bind = { "${wsrep_node_address}::3308" => [] },
$haproxy_balancermember_options = 'check port 9200 inter 12000 rise 3 fall 3 weight 100',
$haproxy_readwrite_is_readonly_backup = false,
$buffersize = $::percona::params::buffersize,
$pool_instances = $::percona::params::pool_instances,
$max_connections = $::percona::params::max_connections,
......@@ -91,15 +92,16 @@ class percona(
# haproxy
class { '::percona::server::haproxy' :
clustername => $clustername,
wsrep_node_address => $wsrep_node_address,
haproxy_global_options => $haproxy_global_options,
haproxy_defaults_options => $haproxy_defaults_options,
haproxy_backend_options => $haproxy_backend_options,
haproxy_socket => $haproxy_socket,
haproxy_readonly_frontend_bind => $haproxy_readonly_frontend_bind,
haproxy_readwrite_frontend_bind => $haproxy_readwrite_frontend_bind,
haproxy_balancermember_options => $haproxy_balancermember_options,
require => Class['::percona::server::clustercheck'],
clustername => $clustername,
wsrep_node_address => $wsrep_node_address,
haproxy_global_options => $haproxy_global_options,
haproxy_defaults_options => $haproxy_defaults_options,
haproxy_backend_options => $haproxy_backend_options,
haproxy_socket => $haproxy_socket,
haproxy_readonly_frontend_bind => $haproxy_readonly_frontend_bind,
haproxy_readwrite_frontend_bind => $haproxy_readwrite_frontend_bind,
haproxy_balancermember_options => $haproxy_balancermember_options,
haproxy_readwrite_is_readonly_backup => $haproxy_readwrite_is_readonly_backup,
require => Class['::percona::server::clustercheck'],
}
}
......@@ -10,6 +10,7 @@ class percona::server::haproxy(
$haproxy_readonly_frontend_bind = { "${wsrep_node_address}:3307" => [] },
$haproxy_readwrite_frontend_bind = { "${wsrep_node_address}:3308" => [] },
$haproxy_balancermember_options = 'check port 9200 inter 12000 rise 3 fall 3 weight 100',
$haproxy_readwrite_is_readonly_backup = false,
){
if $::osfamily == 'Debian' {
......@@ -130,12 +131,18 @@ class percona::server::haproxy(
Haproxy::Balancermember<<| listening_service == "${clustername}-ro" and tag == 'bzed-percona_cluster' |>>
Haproxy::Balancermember<<| listening_service == "${clustername}-rw" and tag == 'bzed-percona_cluster' |>>
if $haproxy_readwrite_is_readonly_backup and $rw_backend {
$ro_backup = ' backup'
} else {
$ro_backup = ''
}
@@::haproxy::balancermember{"${::hostname}-ro":
listening_service => "${clustername}-ro",
ports => 3306,
ipaddresses => $wsrep_node_address,
server_names => $::hostname,
options => $haproxy_balancermember_options,
options => "${haproxy_balancermember_options}${ro_backup}",
tag => 'bzed-percona_cluster',
}
......@@ -144,7 +151,7 @@ class percona::server::haproxy(
$rw_backup = ''
#lint:endignore
} else {
$rw_backup = 'backup'
$rw_backup = ' backup'
}
@@::haproxy::balancermember{"${::hostname}-rw":
......@@ -152,7 +159,7 @@ class percona::server::haproxy(
ports => 3306,
ipaddresses => $wsrep_node_address,
server_names => $::hostname,
options => "${haproxy_balancermember_options} ${rw_backup}",
options => "${haproxy_balancermember_options}${rw_backup}",
tag => 'bzed-percona_cluster',
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment