Preliminary galera support

This commit is contained in:
Eugene Kirpichov 2012-08-15 13:04:51 -07:00
parent d646654910
commit e124d9ca89
4 changed files with 30 additions and 30 deletions

View File

@ -38,6 +38,7 @@ class mysql::config(
$service_name = $mysql::params::service_name, $service_name = $mysql::params::service_name,
$config_file = $mysql::params::config_file, $config_file = $mysql::params::config_file,
$socket = $mysql::params::socket, $socket = $mysql::params::socket,
$pidfile = $mysql::params::pidfile,
$datadir = $mysql::params::datadir, $datadir = $mysql::params::datadir,
$ssl = $mysql::params::ssl, $ssl = $mysql::params::ssl,
$ssl_ca = $mysql::params::ssl_ca, $ssl_ca = $mysql::params::ssl_ca,
@ -106,14 +107,14 @@ class mysql::config(
} }
} }
file { '/etc/mysql': # file { '/etc/mysql':
ensure => directory, # ensure => directory,
mode => '0755', # mode => '0755',
} # }
file { '/etc/mysql/conf.d': # file { '/etc/mysql/conf.d':
ensure => directory, # ensure => directory,
mode => '0755', # mode => '0755',
} # }
file { $config_file: file { $config_file:
content => template('mysql/my.cnf.erb'), content => template('mysql/my.cnf.erb'),
mode => '0644', mode => '0644',

View File

@ -34,6 +34,7 @@ class mysql::params {
$client_package_name = 'mysql' $client_package_name = 'mysql'
$server_package_name = 'mysql-server' $server_package_name = 'mysql-server'
$socket = '/var/lib/mysql/mysql.sock' $socket = '/var/lib/mysql/mysql.sock'
$pidfile = '/var/run/mysqld/mysqld.pid'
$config_file = '/etc/my.cnf' $config_file = '/etc/my.cnf'
$log_error = '/var/log/mysqld.log' $log_error = '/var/log/mysqld.log'
$ruby_package_name = 'ruby-mysql' $ruby_package_name = 'ruby-mysql'
@ -53,6 +54,7 @@ class mysql::params {
$client_package_name = 'mysql-client' $client_package_name = 'mysql-client'
$server_package_name = 'mysql-server' $server_package_name = 'mysql-server'
$socket = '/var/run/mysqld/mysqld.sock' $socket = '/var/run/mysqld/mysqld.sock'
$pidfile = '/var/run/mysqld/mysqld.pid'
$config_file = '/etc/mysql/my.cnf' $config_file = '/etc/mysql/my.cnf'
$log_error = '/var/log/mysql/error.log' $log_error = '/var/log/mysql/error.log'
$ruby_package_name = 'libmysql-ruby' $ruby_package_name = 'libmysql-ruby'
@ -71,6 +73,7 @@ class mysql::params {
$client_package_name = 'databases/mysql55-client' $client_package_name = 'databases/mysql55-client'
$server_package_name = 'databases/mysql55-server' $server_package_name = 'databases/mysql55-server'
$socket = '/tmp/mysql.sock' $socket = '/tmp/mysql.sock'
$pidfile = '/var/db/mysql/mysql.pid'
$config_file = '/var/db/mysql/my.cnf' $config_file = '/var/db/mysql/my.cnf'
$log_error = "/var/db/mysql/${::hostname}.err" $log_error = "/var/db/mysql/${::hostname}.err"
$ruby_package_name = 'ruby-mysql' $ruby_package_name = 'ruby-mysql'

View File

@ -15,6 +15,7 @@
# Sample Usage: # Sample Usage:
# #
class mysql::server ( class mysql::server (
$custom_setup_class = undef,
$package_name = $mysql::params::server_package_name, $package_name = $mysql::params::server_package_name,
$package_ensure = 'present', $package_ensure = 'present',
$service_name = $mysql::params::service_name, $service_name = $mysql::params::service_name,
@ -22,31 +23,25 @@ class mysql::server (
$config_hash = {}, $config_hash = {},
$enabled = true $enabled = true
) inherits mysql::params { ) inherits mysql::params {
Class['mysql::server'] -> Class['mysql::config'] Class['mysql::server'] -> Class['mysql::config']
$config_class = {} create_resources( 'class', { 'mysql::config' => $config_hash } )
$config_class['mysql::config'] = $config_hash
create_resources( 'class', $config_class ) if ($custom_setup_class == undef) {
package { 'mysql-server':
package { 'mysql-server': name => $package_name,
name => $package_name, ensure => $package_ensure,
ensure => $package_ensure, }
}
service { 'mysqld':
if $enabled { name => $service_name,
$service_ensure = 'running' ensure => $enabled ? { true => 'running', default => 'stopped' },
enable => $enabled,
require => Package['mysql-server'],
provider => $service_provider,
}
} else { } else {
$service_ensure = 'stopped' require($custom_setup_class)
} }
service { 'mysqld':
name => $service_name,
ensure => $service_ensure,
enable => $enabled,
require => Package['mysql-server'],
provider => $service_provider,
}
} }

View File

@ -6,6 +6,7 @@ socket = <%= socket %>
nice = 0 nice = 0
[mysqld] [mysqld]
user = mysql user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = <%= socket %> socket = <%= socket %>
port = <%= port %> port = <%= port %>
basedir = <%= basedir %> basedir = <%= basedir %>