Use 'mgmt/database' network for Galera cluster

Configure Galera to use network with 'mgmt/database'
role for database replication. Also it should listen
for connections only on IP from that network.

Change-Id: I375e94b5da82276207a49ac28b5ce306904e1293
Closes-bug: #1492158
This commit is contained in:
Artem Panchenko 2015-09-04 11:18:30 +03:00
parent f378048487
commit 520a7ee6e8
3 changed files with 16 additions and 2 deletions

View File

@ -61,6 +61,7 @@ wsrep_sst_auth=<%= @mysql_user %>:<%= @mysql_password %>
<% end -%>
wsrep_node_address=<%= @node_address %>
wsrep_provider_options="gcache.size = <%= [256, @gcache_factor.to_i*64, 2048].sort[1] %>M"
wsrep_provider_options="gmcast.listen_addr = tcp://<%= @node_address %>:<%= @gcomm_port.to_s %>"
<% if @wsrep_sst_method =~ /xtrabackup/ -%>
[xtrabackup]

View File

@ -19,7 +19,7 @@ $mysql_database_password = $mysql_hash['root_password']
$enabled = pick($mysql_hash['enabled'], true)
$galera_node_address = get_network_role_property('mgmt/database', 'ipaddr')
$galera_nodes = keys(get_node_to_ipaddr_map_by_network_role(hiera_hash('database_nodes'), 'mgmt/database'))
$galera_nodes = values(get_node_to_ipaddr_map_by_network_role(hiera_hash('database_nodes'), 'mgmt/database'))
$galera_primary_controller = hiera('primary_database', $primary_controller)
$mysql_bind_address = '0.0.0.0'
$galera_cluster_name = 'openstack'

View File

@ -16,6 +16,14 @@ describe manifest do
access_networks = ['localhost', '127.0.0.1', '240.0.0.0/255.255.0.0'] + other_networks.split(' ')
end
let(:database_nodes) do
Noop.hiera('database_nodes')
end
let(:galera_nodes) do
(Noop.puppet_function 'get_node_to_ipaddr_map_by_network_role', database_nodes, 'mgmt/database').values
end
it "should delcare osnailyfacter::mysql_user with correct other_networks" do
expect(subject).to contain_class('osnailyfacter::mysql_user').with(
'user' => 'root',
@ -23,7 +31,12 @@ describe manifest do
).that_comes_before('Exec[initial_access_config]')
end
it { should contain_class('mysql::server').that_comes_before('Osnailyfacter::Mysql_user') }
it "should configure Galera to use mgmt/database network for replication" do
expect(subject).to contain_class('mysql::server').with(
'galera_nodes' => galera_nodes,
).that_comes_before('Osnailyfacter::Mysql_user')
end
it { should contain_class('osnailyfacter::mysql_access') }
it { should contain_class('openstack::galera::status').that_comes_before('Haproxy_backend_status[mysql]') }
it { should contain_haproxy_backend_status('mysql').that_comes_before('Class[osnailyfacter::mysql_access]') }