arioch/puppet-percona — pull request #20 by bluefoxicy (2013-02-02 07:16:56+00:00)
Title: Xtradb cluster

Was a bit over-zealous before. First time working on an open source project, sent a pull request before it was ready.

I was going to request a pull to development, but your development branch looks like it needs a sync to your master branch badly.

This works well now. Sample configuration below.

```puppet
node /^db-\d+\.example\.com$/ {
$svr_idx = regsubst($fqdn, '^db-(\d+)\.example\.com', '\1')

# Install the cluster database server
# Just YAML this and use hiera
class { 'percona':
server => 'true',
cluster => 'true',
cluster_index => $svr_idx,
cluster_name => 'db-cluster',
cluster_node_name => $hostname,
cluster_address => $svr_idx ? {
1 => 'gcomm://',
default => 'gcomm://db-1.example.com',
},
cluster_replication_user => 'cluster',
cluster_replication_password => 'cluster_password',
targetdir => '/var/lib/mysql/backup',
# Set as below to install Percona-XtraDB-Cluster-common
# Otherwise leave undef, or you can't install redhat-lsb
# pkg_compat => false,
manage_repo => 'true',
# Required. If /etc/my.cnf is root:root, xtrabackup fails
# as it tries to reread the file as user mysql
config_user => 'mysql',
config_group => 'mysql',
# Do this if /var/lib/mysql is a mount point
datadir => '/var/lib/mysql/db/',
configuration => {
# Query cache is currently disabled with wsrep
# 'mysqld/query_cache_size' => '16M',
# 'mysqld/query_cache_limit' => '8M',
# 'mysqld/query_cache_type' => '1',
'mysqld/max_connections' => '536',
'mysqld/interactive_timeout' => '300',
'mysqld/wait_timeout' => '300',
'mysqld/connect_timeout' => '10',
'mysqld/thread_cache_size' => '512',
'mysqld/expire_logs_days' => '30',
'mysqld/max_binlog_size' => '256M',
'mysqld/table_cache' => '1024',
# 'mysqld/table_open_cache' => '512',
'mysqld/table_definition_cache' => '1024',
'mysqld/auto_increment_offset' => $svr_idx,
# Should be at least 2x the number of cores,
# or 1/4 the number of writing client connections
# the other nodes have
# Set to 1 if you have ANY tables without primary keys!
# Tables without primary keys make MySQL slow, so fix that...
'mysqld/wsrep_slave_threads' => '1',
# This attempts to retry the commit 4 times if there's a deadlock
'mysqld/wsrep_retry_autocommit' => '4',
},
}

file { '/var/lib/mysql/backup':
ensure => directory,
mode => 'ug+rwX,o=r,o-x',
owner => 'mysql',
group => 'mysql',
}
}
```