From 253aaeb13888993b72438032aaaaca139c6e4113 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Thu, 18 Sep 2014 10:42:35 +0200 Subject: [PATCH] [galera] Some master/slave tweaks This adds some tweaks for galera master/slave setup It also allows to customize the galera gcache size, This value depends mainly of the database traffic. But the default value of 128M is clearly to low for us, this means if a down node comeback and the data that need to be transfered is greater than 128MB a full sync if done instead of an incremental. So we use 1G by default and that should changed in case of a deployement with a big database workload. --- manifests/database/sql.pp | 1 + spec/classes/cloud_database_sql_spec.rb | 5 +++-- templates/database/mysql.conf.erb | 10 ++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/manifests/database/sql.pp b/manifests/database/sql.pp index 34706a61..194f120e 100644 --- a/manifests/database/sql.pp +++ b/manifests/database/sql.pp @@ -26,6 +26,7 @@ class cloud::database::sql ( $service_provider = 'sysv', $galera_master_name = 'mgmt001', $galera_internal_ips = ['127.0.0.1'], + $galera_gcache = '1G', $keystone_db_host = '127.0.0.1', $keystone_db_user = 'keystone', $keystone_db_password = 'keystonepassword', diff --git a/spec/classes/cloud_database_sql_spec.rb b/spec/classes/cloud_database_sql_spec.rb index 01386658..6b76f2a9 100644 --- a/spec/classes/cloud_database_sql_spec.rb +++ b/spec/classes/cloud_database_sql_spec.rb @@ -32,6 +32,7 @@ describe 'cloud::database::sql' do :api_eth => '10.0.0.1', :galera_master_name => 'os-ci-test1', :galera_internal_ips => ['10.0.0.1','10.0.0.2','10.0.0.3'], + :galera_gcache => '1G', :keystone_db_host => '10.0.0.1', :keystone_db_user => 'keystone', :keystone_db_password => 'secrete', @@ -88,8 +89,8 @@ describe 'cloud::database::sql' do context 'configure mysqlchk http replication' do it { should contain_file('/etc/xinetd.d/mysqlchk').with_mode('0755') } it { should contain_file('/usr/bin/clustercheck').with_mode('0755') } - it { should contain_file('/usr/bin/clustercheck').with_content(/MYSQL_USERNAME="#{params[:galera_clustercheck_dbuser]}"/)} - it { should contain_file('/usr/bin/clustercheck').with_content(/MYSQL_PASSWORD="#{params[:galera_clustercheck_dbpassword]}"/)} + it { should contain_file('/usr/bin/clustercheck').with_content(/MYSQL_USERNAME='#{params[:galera_clustercheck_dbuser]}'/)} + it { should contain_file('/usr/bin/clustercheck').with_content(/MYSQL_PASSWORD='#{params[:galera_clustercheck_dbpassword]}'/)} it { should contain_file('/etc/xinetd.d/mysqlchk').with_content(/bind = #{params[:galera_clustercheck_ipaddress]}/)} end # configure mysqlchk http replication diff --git a/templates/database/mysql.conf.erb b/templates/database/mysql.conf.erb index fca71da0..46ea36a6 100644 --- a/templates/database/mysql.conf.erb +++ b/templates/database/mysql.conf.erb @@ -49,14 +49,16 @@ wsrep_provider = "<%= @wsrep_provider %>" wsrep_cluster_name = "galera_cluster" wsrep_cluster_address = "gcomm://<%= @gcomm_definition %>" wsrep_sst_auth = root:<%= @mysql_root_password %> -wsrep_certify_nonPK = 1 -wsrep_convert_LOCK_to_trx = 0 -wsrep_auto_increment_control = 1 wsrep_drupal_282555_workaround = 0 -wsrep_causal_reads = 0 wsrep_sst_method = rsync wsrep_node_address = "<%= @api_eth %>" wsrep_node_incoming_address = "<%= @api_eth %>" +# This is the minimal value (proc*2) +wsrep_slave_threads = "<%= @processorcount.to_i * 2 %>" + +# Thoses TWEAK assume that the galera cluster is used in master/slave mode +wsrep_provider_options = "gcache.size=<%= @galera_gcache %>;gcs.fc_master_slave=1;gcs.fc_limit=256;gcs.fc_factor=0.9" + # this value here are used by /usr/bin/innobackupex # and wsrep_sst_xtrabackup take only one configuration file and use the last one # (/etc/mysql/my.cnf is not used)