Enable xtrabackup methods for Galera SST

- Enable xtrabackup as SST method for Galera
- Turn off perfomance_schema on
- Remove old openssl packet
- Slightly decrease RAM for innodb_buffer_pool_size
- Set 1M buffer for send/recieve socket for socat to
  speed up SST between nodes

Change-Id: I9b0b5eee6deab366324f1f808e32f64e290b444e
Implements: bp/galera-improvements
Closes-Bug: 1354479
This commit is contained in:
Sergii Golovatiuk 2014-07-25 14:18:08 +00:00
parent 860c992e2f
commit 989a64693a
3 changed files with 49 additions and 11 deletions

View File

@ -44,6 +44,10 @@
# [*node_addresses*]
# Array with IPs/hostnames of cluster members.
#
# [*wsrep_sst_method*]
# (optional) The method for state snapshot transfer between nodes
# Defaults to xtrabackup-v2
# xtrabackup, xtrabackup-v2, mysqldump are supported
class galera (
$cluster_name = 'openstack',
@ -55,6 +59,7 @@ class galera (
$use_syslog = false,
$gcomm_port = '4567',
$status_check = true,
$wsrep_sst_method = 'xtrabackup-v2'
) {
include galera::params
@ -98,8 +103,7 @@ class galera (
before => Package['MySQL-server']
}
package { [$::galera::params::libssl_package,
$::galera::params::libaio_package]:
package { $::galera::params::libaio_package:
ensure => present,
before => Package['galera', 'MySQL-server']
}
@ -115,6 +119,27 @@ class galera (
$wsrep_version = 'installed'
}
if $wsrep_sst_method in [ 'xtrabackup', 'xtrabackup-v2' ] {
firewall {'101 xtrabackup':
port => 4444,
proto => 'tcp',
action => 'accept',
before => Package['MySQL-server'],
}
package { 'percona-xtrabackup':
ensure => present,
before => Package['MySQL-server'],
}
$wsrep_sst_auth = true
}
elsif $wsrep_sst_method == 'mysqldump' {
$wsrep_sst_auth = true
}
else {
$wsrep_sst_auth = undef
warning("Unrecognized wsrep_sst method: ${wsrep_sst_auth}")
}
package { 'MySQL-server':
ensure => $wsrep_version,
name => $::galera::params::mysql_server_name,
@ -128,6 +153,7 @@ class galera (
before => File['mysql-wss-ocf']
}
if $primary_controller {
$galera_pid = $::osfamily ? {
'RedHat' => '/var/run/mysql/mysqld.pid',
@ -187,8 +213,7 @@ class galera (
File<| title == 'ocf-mirantis-path' |> -> File['mysql-wss-ocf']
Package['MySQL-server'] -> File['mysql-wss-ocf']
Package['galera'] -> File['mysql-wss-ocf']
Package['MySQL-server', 'galera'] -> File['mysql-wss-ocf']
tweaks::ubuntu_service_override { "${service_name}":
package_name => 'MySQL-server',
@ -225,8 +250,7 @@ class galera (
# evaluate existing log file size and use it as a value
$innodb_log_file_size_real = $::mysql_log_file_size_real
}
}
}
file { '/etc/mysql/conf.d/wsrep.cnf':
ensure => present,
content => template('galera/wsrep.cnf.erb'),

View File

@ -23,10 +23,10 @@ class galera::params {
#TODO(bogdando) remove code duplication for galera and mysql manifests to openstack::db in 'I' release
#limit buffer size to 10G
$buffer_size =
inline_template("<%= [(${::memorysize_mb} * 0.3 + 0).floor, 10000].min %>")
inline_template("<%= [(${::memorysize_mb} * 0.2 + 0).floor, 10000].min %>")
$mysql_buffer_pool_size = "${buffer_size}M"
$mysql_log_file_size =
inline_template("<%= [(${buffer_size} * 0.25 + 0).floor, 2047].min %>M")
inline_template("<%= [(${buffer_size} * 0.2 + 0).floor, 2047].min %>M")
$wait_timeout = '1800'
$myisam_sort_buffer_size = '64M'
$key_buffer_size = '64M'
@ -36,14 +36,12 @@ class galera::params {
case $::osfamily {
'RedHat': {
$libssl_package = 'openssl098e'
$libaio_package = 'libaio'
$mysql_server_name = 'MySQL-server-wsrep'
$mysql_client_name = 'MySQL-client-wsrep'
$libgalera_prefix = '/usr/lib64'
}
'Debian': {
$libssl_package = 'libssl0.9.8'
$libaio_package = 'libaio1'
$mysql_server_name = 'mysql-server-wsrep-5.6'
$mysql_client_name = 'mysql-client-5.6'

View File

@ -1,4 +1,5 @@
[mysqld]
datadir=<%= @datadir %>
bind-address=<%= @node_address %>
port=3307
max_connections=<%= @max_connections %>
@ -14,6 +15,9 @@ skip-external-locking
<% if @skip_name_resolve -%>
skip-name-resolve
<% end -%>
<% if scope.lookupvar('memorysize_mb').to_i < 4000 -%>
performance_schema=off
<% end -%>
myisam_sort_buffer_size=<%= @myisam_sort_buffer_size %>
wait_timeout=<%= @wait_timeout %>
@ -48,6 +52,18 @@ wsrep_provider=<%= @libgalera_prefix %>/galera/libgalera_smm.so
wsrep_cluster_name="<%= @cluster_name -%>"
wsrep_slave_threads=<%= [[@processorcount.to_i*2, 4].max, 12].min %>
wsrep_sst_method=mysqldump
wsrep_sst_method=<%= @wsrep_sst_method %>
<% if @wsrep_sst_auth -%>
wsrep_sst_auth=<%= @mysql_user %>:<%= @mysql_password %>
<% end -%>
wsrep_node_address=<%= @node_address %>
<% if @wsrep_sst_method =~ /xtrabackup/ -%>
[xtrabackup]
parallel=<%= [[@processorcount.to_i, 2].max, 6].min %>
[sst]
streamfmt=xbstream
transferfmt=socat
sockopt=,nodelay,sndbuf=1048576,rcvbuf=1048576
<% end -%>