Merge pull request #97 from bodepd/revert
Revert "Merge pull request #90 from emonty/master"
This commit is contained in:
commit
3084f8c44c
9 changed files with 78 additions and 392 deletions
|
@ -6,5 +6,3 @@ license 'Apache 2.0'
|
||||||
summary 'Mysql module'
|
summary 'Mysql module'
|
||||||
description 'Mysql module'
|
description 'Mysql module'
|
||||||
project_page 'http://github.com/puppetlabs/puppetlabs-mysql'
|
project_page 'http://github.com/puppetlabs/puppetlabs-mysql'
|
||||||
|
|
||||||
dependency 'openstackci/apparmor', '>= 0.0.1'
|
|
||||||
|
|
|
@ -7,40 +7,31 @@ Puppet::Type.type(:database).provide(:mysql) do
|
||||||
optional_commands :mysql => 'mysql'
|
optional_commands :mysql => 'mysql'
|
||||||
optional_commands :mysqladmin => 'mysqladmin'
|
optional_commands :mysqladmin => 'mysqladmin'
|
||||||
|
|
||||||
def defaults_file
|
|
||||||
case Facter.value(:operatingsystem)
|
|
||||||
when "Debian", "Ubuntu"
|
|
||||||
return "--defaults-file=/etc/mysql/debian.cnf"
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.instances
|
def self.instances
|
||||||
mysql(defaults_file, '-NBe', "show databases").split("\n").collect do |name|
|
mysql('-NBe', "show databases").split("\n").collect do |name|
|
||||||
new(:name => name)
|
new(:name => name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
mysql(defaults_file, '-NBe', "create database `#{@resource[:name]}` character set #{resource[:charset]}")
|
mysql('-NBe', "create database `#{@resource[:name]}` character set #{resource[:charset]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
mysqladmin(defaults_file, '-f', 'drop', @resource[:name])
|
mysqladmin('-f', 'drop', @resource[:name])
|
||||||
end
|
end
|
||||||
|
|
||||||
def charset
|
def charset
|
||||||
mysql(defaults_file, '-NBe', "show create database `#{resource[:name]}`").match(/.*?(\S+)\s\*\//)[1]
|
mysql('-NBe', "show create database `#{resource[:name]}`").match(/.*?(\S+)\s\*\//)[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
def charset=(value)
|
def charset=(value)
|
||||||
mysql(defaults_file, '-NBe', "alter database `#{resource[:name]}` CHARACTER SET #{value}")
|
mysql('-NBe', "alter database `#{resource[:name]}` CHARACTER SET #{value}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def exists?
|
def exists?
|
||||||
begin
|
begin
|
||||||
mysql(defaults_file, '-NBe', "show databases").match(/^#{@resource[:name]}$/)
|
mysql('-NBe', "show databases").match(/^#{@resource[:name]}$/)
|
||||||
rescue => e
|
rescue => e
|
||||||
debug(e.message)
|
debug(e.message)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -12,15 +12,6 @@ Puppet::Type.type(:database_grant).provide(:mysql) do
|
||||||
optional_commands :mysql => 'mysql'
|
optional_commands :mysql => 'mysql'
|
||||||
optional_commands :mysqladmin => 'mysqladmin'
|
optional_commands :mysqladmin => 'mysqladmin'
|
||||||
|
|
||||||
def defaults_file
|
|
||||||
case Facter.value(:operatingsystem)
|
|
||||||
when "Debian", "Ubuntu"
|
|
||||||
return "--defaults-file=/etc/mysql/debian.cnf"
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.prefetch(resources)
|
def self.prefetch(resources)
|
||||||
@user_privs = query_user_privs
|
@user_privs = query_user_privs
|
||||||
@db_privs = query_db_privs
|
@db_privs = query_db_privs
|
||||||
|
@ -43,19 +34,19 @@ Puppet::Type.type(:database_grant).provide(:mysql) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.query_user_privs
|
def self.query_user_privs
|
||||||
results = mysql(defaults_file, "-Be", "describe user")
|
results = mysql("mysql", "-Be", "describe user")
|
||||||
column_names = results.split(/\n/).map { |l| l.chomp.split(/\t/)[0] }
|
column_names = results.split(/\n/).map { |l| l.chomp.split(/\t/)[0] }
|
||||||
@user_privs = column_names.delete_if { |e| !( e =~/_priv$/) }
|
@user_privs = column_names.delete_if { |e| !( e =~/_priv$/) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.query_db_privs
|
def self.query_db_privs
|
||||||
results = mysql(defaults_file, "-Be", "describe db")
|
results = mysql("mysql", "-Be", "describe db")
|
||||||
column_names = results.split(/\n/).map { |l| l.chomp.split(/\t/)[0] }
|
column_names = results.split(/\n/).map { |l| l.chomp.split(/\t/)[0] }
|
||||||
@db_privs = column_names.delete_if { |e| !(e =~/_priv$/) }
|
@db_privs = column_names.delete_if { |e| !(e =~/_priv$/) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def mysql_flush
|
def mysql_flush
|
||||||
mysqladmin defaults_file, "flush-privileges"
|
mysqladmin "flush-privileges"
|
||||||
end
|
end
|
||||||
|
|
||||||
# this parses the
|
# this parses the
|
||||||
|
@ -83,11 +74,11 @@ Puppet::Type.type(:database_grant).provide(:mysql) do
|
||||||
name = split_name(@resource[:name])
|
name = split_name(@resource[:name])
|
||||||
case name[:type]
|
case name[:type]
|
||||||
when :user
|
when :user
|
||||||
mysql defaults_file, "-e", "INSERT INTO user (host, user) VALUES ('%s', '%s')" % [
|
mysql "mysql", "-e", "INSERT INTO user (host, user) VALUES ('%s', '%s')" % [
|
||||||
name[:host], name[:user],
|
name[:host], name[:user],
|
||||||
]
|
]
|
||||||
when :db
|
when :db
|
||||||
mysql defaults_file, "-e", "INSERT INTO db (host, user, db) VALUES ('%s', '%s', '%s')" % [
|
mysql "mysql", "-e", "INSERT INTO db (host, user, db) VALUES ('%s', '%s', '%s')" % [
|
||||||
name[:host], name[:user], name[:db],
|
name[:host], name[:user], name[:db],
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
@ -96,7 +87,7 @@ Puppet::Type.type(:database_grant).provide(:mysql) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
mysql defaults_file, "-e", "REVOKE ALL ON '%s'.* FROM '%s@%s'" % [ @resource[:privileges], @resource[:database], @resource[:name], @resource[:host] ]
|
mysql "mysql", "-e", "REVOKE ALL ON '%s'.* FROM '%s@%s'" % [ @resource[:privileges], @resource[:database], @resource[:name], @resource[:host] ]
|
||||||
end
|
end
|
||||||
|
|
||||||
def row_exists?
|
def row_exists?
|
||||||
|
@ -105,7 +96,7 @@ Puppet::Type.type(:database_grant).provide(:mysql) do
|
||||||
if name[:type] == :db
|
if name[:type] == :db
|
||||||
fields << :db
|
fields << :db
|
||||||
end
|
end
|
||||||
not mysql( defaults_file, "-NBe", 'SELECT "1" FROM %s WHERE %s' % [ name[:type], fields.map do |f| "%s = '%s'" % [f, name[f]] end.join(' AND ')]).empty?
|
not mysql( "mysql", "-NBe", 'SELECT "1" FROM %s WHERE %s' % [ name[:type], fields.map do |f| "%s = '%s'" % [f, name[f]] end.join(' AND ')]).empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_privs_set?
|
def all_privs_set?
|
||||||
|
@ -127,9 +118,9 @@ Puppet::Type.type(:database_grant).provide(:mysql) do
|
||||||
|
|
||||||
case name[:type]
|
case name[:type]
|
||||||
when :user
|
when :user
|
||||||
privs = mysql defaults_file, "-Be", 'select * from user where user="%s" and host="%s"' % [ name[:user], name[:host] ]
|
privs = mysql "mysql", "-Be", 'select * from user where user="%s" and host="%s"' % [ name[:user], name[:host] ]
|
||||||
when :db
|
when :db
|
||||||
privs = mysql defaults_file, "-Be", 'select * from db where user="%s" and host="%s" and db="%s"' % [ name[:user], name[:host], name[:db] ]
|
privs = mysql "mysql", "-Be", 'select * from db where user="%s" and host="%s" and db="%s"' % [ name[:user], name[:host], name[:db] ]
|
||||||
end
|
end
|
||||||
|
|
||||||
if privs.match(/^$/)
|
if privs.match(/^$/)
|
||||||
|
@ -180,7 +171,7 @@ Puppet::Type.type(:database_grant).provide(:mysql) do
|
||||||
# puts "set:", set
|
# puts "set:", set
|
||||||
stmt = stmt << set << where
|
stmt = stmt << set << where
|
||||||
|
|
||||||
mysql defaults_file, "-Be", stmt
|
mysql "mysql", "-Be", stmt
|
||||||
mysql_flush
|
mysql_flush
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,45 +7,36 @@ Puppet::Type.type(:database_user).provide(:mysql) do
|
||||||
optional_commands :mysql => 'mysql'
|
optional_commands :mysql => 'mysql'
|
||||||
optional_commands :mysqladmin => 'mysqladmin'
|
optional_commands :mysqladmin => 'mysqladmin'
|
||||||
|
|
||||||
def defaults_file
|
|
||||||
case Facter.value(:operatingsystem)
|
|
||||||
when "Debian", "Ubuntu"
|
|
||||||
return "--defaults-file=/etc/mysql/debian.cnf"
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.instances
|
def self.instances
|
||||||
users = mysql(defaults_file, '-BNe' "select concat(User, '@',Host) as User from mysql.user").split("\n")
|
users = mysql("mysql", '-BNe' "select concat(User, '@',Host) as User from mysql.user").split("\n")
|
||||||
users.select{ |user| user =~ /.+@/ }.collect do |name|
|
users.select{ |user| user =~ /.+@/ }.collect do |name|
|
||||||
new(:name => name)
|
new(:name => name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
mysql(defaults_file, "-e", "create user '%s' identified by PASSWORD '%s'" % [ @resource[:name].sub("@", "'@'"), @resource.value(:password_hash) ])
|
mysql("mysql", "-e", "create user '%s' identified by PASSWORD '%s'" % [ @resource[:name].sub("@", "'@'"), @resource.value(:password_hash) ])
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
mysql(defaults_file, "-e", "drop user '%s'" % @resource.value(:name).sub("@", "'@'") )
|
mysql("mysql", "-e", "drop user '%s'" % @resource.value(:name).sub("@", "'@'") )
|
||||||
end
|
end
|
||||||
|
|
||||||
def password_hash
|
def password_hash
|
||||||
mysql(defaults_file, "-NBe", "select password from user where CONCAT(user, '@', host) = '%s'" % @resource.value(:name)).chomp
|
mysql("mysql", "-NBe", "select password from user where CONCAT(user, '@', host) = '%s'" % @resource.value(:name)).chomp
|
||||||
end
|
end
|
||||||
|
|
||||||
def password_hash=(string)
|
def password_hash=(string)
|
||||||
mysql(defaults_file, "-e", "SET PASSWORD FOR '%s' = '%s'" % [ @resource[:name].sub("@", "'@'"), string ] )
|
mysql("mysql", "-e", "SET PASSWORD FOR '%s' = '%s'" % [ @resource[:name].sub("@", "'@'"), string ] )
|
||||||
end
|
end
|
||||||
|
|
||||||
def exists?
|
def exists?
|
||||||
not mysql(defaults_file, "-NBe", "select '1' from user where CONCAT(user, '@', host) = '%s'" % @resource.value(:name)).empty?
|
not mysql("mysql", "-NBe", "select '1' from user where CONCAT(user, '@', host) = '%s'" % @resource.value(:name)).empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def flush
|
def flush
|
||||||
@property_hash.clear
|
@property_hash.clear
|
||||||
mysqladmin(defaults_file, "flush-privileges")
|
mysqladmin "flush-privileges"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,56 +44,8 @@ class mysql::config(
|
||||||
$ssl_cert = $mysql::params::ssl_cert,
|
$ssl_cert = $mysql::params::ssl_cert,
|
||||||
$ssl_key = $mysql::params::ssl_key,
|
$ssl_key = $mysql::params::ssl_key,
|
||||||
$log_error = $mysql::params::log_error,
|
$log_error = $mysql::params::log_error,
|
||||||
$slow_query_log_file = $mysql::params::slow_query_log_file,
|
|
||||||
$long_query_time = $mysql::params::long_query_time,
|
|
||||||
$character_set_server = $mysql::params::character_set_server,
|
|
||||||
$collation_server = $mysql::params::collation_server,
|
|
||||||
$tmp_table_size = $mysql::params::tmp_table_size,
|
|
||||||
$max_heap_table_size = $mysql::params::max_heap_table_size,
|
|
||||||
$max_tmp_tables = $mysql::params::max_tmp_tables,
|
|
||||||
$join_buffer_size = $mysql::params::join_buffer_size,
|
|
||||||
$read_buffer_size = $mysql::params::read_buffer_size,
|
|
||||||
$sort_buffer_size = $mysql::params::sort_buffer_size,
|
|
||||||
$table_cache = $mysql::params::table_cache,
|
|
||||||
$table_definition_cache = $mysql::params::table_definition_cache,
|
|
||||||
$open_files_limit = $mysql::params::open_files_limit,
|
|
||||||
$thread_stack = $mysql::params::thread_stack,
|
|
||||||
$thread_cache_size = $mysql::params::thread_cache_size,
|
|
||||||
$thread_concurrency = $mysql::params::thread_concurrency,
|
|
||||||
$query_cache_size = $mysql::params::query_cache_size,
|
|
||||||
$query_cache_limit = $mysql::params::query_cache_limit,
|
|
||||||
$tmp_table_size = $mysql::params::tmp_table_size,
|
|
||||||
$read_rnd_buffer_size = $mysql::params::read_rnd_buffer_size,
|
|
||||||
$max_allowed_packet = $mysql::params::max_allowed_packet,
|
|
||||||
$max_connections = $mysql::params::max_connections,
|
|
||||||
$wait_timeout = $mysql::params::wait_timeout,
|
|
||||||
$connect_timeout = $mysql::params::connect_timeout,
|
|
||||||
$innodb_file_per_table = $mysql::params::innodb_file_per_table,
|
|
||||||
$innodb_status_file = $mysql::params::innodb_status_file,
|
|
||||||
$innodb_support_xa = $mysql::params::innodb_support_xa,
|
|
||||||
$read_only = $mysql::params::read_only,
|
|
||||||
$replication_enabled = $mysql::params::replication_enabled,
|
|
||||||
$expire_logs_days = $mysql::params::expire_logs_days,
|
|
||||||
$max_binlog_size = $mysql::params::max_binlog_size,
|
|
||||||
$replicate_ignore_table = $mysql::params::replicate_ignore_table,
|
|
||||||
$replicate_ignore_db = $mysql::params::replicate_ignore_db,
|
|
||||||
$replicate_do_table = $mysql::params::replicate_do_table,
|
|
||||||
$replicate_do_db = $mysql::params::replicate_do_db,
|
|
||||||
$extra_configs = $mysql::params::extra_configs,
|
|
||||||
$default_engine = 'UNSET',
|
$default_engine = 'UNSET',
|
||||||
$root_group = $mysql::params::root_group,
|
$root_group = $mysql::params::root_group
|
||||||
|
|
||||||
$key_buffer_size = $mysql::params::key_buffer_size,
|
|
||||||
$myisam_sort_buffer_size = $mysql::params::myisam_sort_buffer_size,
|
|
||||||
$myisam_max_sort_file_size = $mysql::params::myisam_max_sort_file_size,
|
|
||||||
$myisam_recover = $mysql::params::myisam_recover,
|
|
||||||
$innodb_flush_log_at_trx_commit = $mysql::params::innodb_flush_log_at_trx_commit,
|
|
||||||
$innodb_buffer_pool_size = $mysql::params::innodb_buffer_pool_size,
|
|
||||||
$innodb_log_file_size = $mysql::params::innodb_log_file_size,
|
|
||||||
$innodb_flush_method = $mysql::params::innodb_flush_method,
|
|
||||||
$innodb_thread_concurrency = $mysql::params::innodb_thread_concurrency,
|
|
||||||
$innodb_concurrency_tickets = $mysql::params::innodb_concurrency_tickets,
|
|
||||||
$innodb_doublewrite = $mysql::params::innodb_doublewrite,
|
|
||||||
) inherits mysql::params {
|
) inherits mysql::params {
|
||||||
|
|
||||||
File {
|
File {
|
||||||
|
|
|
@ -16,63 +16,13 @@ class mysql::params {
|
||||||
$port = 3306
|
$port = 3306
|
||||||
$etc_root_password = false
|
$etc_root_password = false
|
||||||
$ssl = false
|
$ssl = false
|
||||||
$slow_query_log_file = false
|
|
||||||
$long_query_time = 10
|
|
||||||
$character_set_server = 'utf8'
|
|
||||||
$collation_server = 'utf8_general_ci'
|
|
||||||
$ft_min_word_len = 3
|
|
||||||
$tmp_table_size = '16M'
|
|
||||||
$max_heap_table_size = '16M'
|
|
||||||
$max_tmp_tables = '32'
|
|
||||||
$join_buffer_size = '3M'
|
|
||||||
$read_buffer_size = '4M'
|
|
||||||
$sort_buffer_size = '4M'
|
|
||||||
$table_cache = '64'
|
|
||||||
$table_definition_cache = '256'
|
|
||||||
$open_files_limit = '1024'
|
|
||||||
$thread_stack = '192K'
|
|
||||||
$thread_cache_size = '8'
|
|
||||||
$thread_concurrency = '10'
|
|
||||||
$query_cache_size = '16M'
|
|
||||||
$query_cache_limit = '1M'
|
|
||||||
$tmp_table_size = '16M'
|
|
||||||
$read_rnd_buffer_size = '256K'
|
|
||||||
$key_buffer_size = '16M'
|
|
||||||
$myisam_sort_buffer_size = '8M'
|
|
||||||
$myisam_max_sort_file_size = '512M'
|
|
||||||
$myisam_recover = 'BACKUP'
|
|
||||||
$max_allowed_packet = "16M"
|
|
||||||
$max_connections = '151'
|
|
||||||
$wait_timeout = "28800"
|
|
||||||
$connect_timeout = "10"
|
|
||||||
$innodb_file_per_table = '1'
|
|
||||||
$innodb_status_file = '0'
|
|
||||||
$innodb_support_xa = '0'
|
|
||||||
$innodb_flush_log_at_trx_commit = '0'
|
|
||||||
$innodb_buffer_pool_size = '8M'
|
|
||||||
$innodb_log_file_size = '5M'
|
|
||||||
$innodb_flush_method = 'O_DIRECT'
|
|
||||||
$innodb_thread_concurrency = '8'
|
|
||||||
$innodb_concurrency_tickets = '500'
|
|
||||||
$innodb_doublewrite = '1'
|
|
||||||
$read_only = false
|
|
||||||
$replication_enabled = false
|
|
||||||
$expire_logs_days = '10'
|
|
||||||
$max_binlog_size = '100M'
|
|
||||||
$replicate_ignore_table = []
|
|
||||||
$replicate_ignore_db = []
|
|
||||||
$replicate_do_table = []
|
|
||||||
$replicate_do_db = []
|
|
||||||
$extra_configs = {}
|
|
||||||
|
|
||||||
case $::operatingsystem {
|
case $::operatingsystem {
|
||||||
"Ubuntu": {
|
"Ubuntu": {
|
||||||
$service_provider = upstart
|
$service_provider = upstart
|
||||||
$apparmor_file = 'mysql/templates/apparmor.usr.sbin.mysqld.erb'
|
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
$service_provider = undef
|
$service_provider = undef
|
||||||
$apparmor_file = undef
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@ class mysql::server (
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$service_name = $mysql::params::service_name,
|
$service_name = $mysql::params::service_name,
|
||||||
$service_provider = $mysql::params::service_provider,
|
$service_provider = $mysql::params::service_provider,
|
||||||
$use_apparmor = false,
|
|
||||||
$apparmor_file = $mysql::params::apparmor_file,
|
|
||||||
$config_hash = {},
|
$config_hash = {},
|
||||||
$enabled = true
|
$enabled = true
|
||||||
) inherits mysql::params {
|
) inherits mysql::params {
|
||||||
|
@ -51,16 +49,4 @@ class mysql::server (
|
||||||
provider => $service_provider,
|
provider => $service_provider,
|
||||||
}
|
}
|
||||||
|
|
||||||
if $use_apparmor {
|
|
||||||
include apparmor
|
|
||||||
|
|
||||||
file { "/etc/apparmor.d/usr.sbin.mysqld":
|
|
||||||
owner => 'root',
|
|
||||||
group => 'root',
|
|
||||||
mode => 0644,
|
|
||||||
content => template($apparmor_file),
|
|
||||||
require => Package['mysql-server'],
|
|
||||||
notify => Class['apparmor'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
# vim:syntax=apparmor
|
|
||||||
# Last Modified: Tue Jun 19 17:37:30 2007
|
|
||||||
#include <tunables/global>
|
|
||||||
|
|
||||||
/usr/sbin/mysqld {
|
|
||||||
#include <abstractions/base>
|
|
||||||
#include <abstractions/nameservice>
|
|
||||||
#include <abstractions/user-tmp>
|
|
||||||
#include <abstractions/mysql>
|
|
||||||
#include <abstractions/winbind>
|
|
||||||
|
|
||||||
capability dac_override,
|
|
||||||
capability sys_resource,
|
|
||||||
capability setgid,
|
|
||||||
capability setuid,
|
|
||||||
|
|
||||||
network tcp,
|
|
||||||
|
|
||||||
/etc/hosts.allow r,
|
|
||||||
/etc/hosts.deny r,
|
|
||||||
|
|
||||||
/etc/mysql/*.pem r,
|
|
||||||
/etc/mysql/conf.d/ r,
|
|
||||||
/etc/mysql/conf.d/* r,
|
|
||||||
<%= config_file %> r,
|
|
||||||
/usr/sbin/mysqld mr,
|
|
||||||
/usr/share/mysql/** r,
|
|
||||||
/var/log/mysql.log rw,
|
|
||||||
/var/log/mysql.err rw,
|
|
||||||
<%= datadir %>/ r,
|
|
||||||
<%= datadir %>/** rwk,
|
|
||||||
/var/log/mysql/ r,
|
|
||||||
/var/log/mysql/* rw,
|
|
||||||
<%= pid %> w,
|
|
||||||
<%= socket %> w,
|
|
||||||
|
|
||||||
/sys/devices/system/cpu/ r,
|
|
||||||
}
|
|
|
@ -1,177 +1,42 @@
|
||||||
###
|
[client]
|
||||||
#### This file managed by puppet.
|
port = <%= port %>
|
||||||
###
|
socket = <%= socket %>
|
||||||
|
[mysqld_safe]
|
||||||
#
|
socket = <%= socket %>
|
||||||
# * IMPORTANT
|
nice = 0
|
||||||
# If you make changes to these settings and your system uses apparmor, you may
|
|
||||||
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
[mysqld]
|
[mysqld]
|
||||||
|
user = mysql
|
||||||
|
socket = <%= socket %>
|
||||||
|
port = <%= port %>
|
||||||
basedir = <%= basedir %>
|
basedir = <%= basedir %>
|
||||||
datadir = <%= datadir %>
|
datadir = <%= datadir %>
|
||||||
tmpdir = <%= tmpdir %>
|
tmpdir = /tmp
|
||||||
socket = <%= socket %>
|
skip-external-locking
|
||||||
pid-file = <%= pid %>
|
bind-address = <%= bind_address %>
|
||||||
user = mysql
|
key_buffer = 16M
|
||||||
|
max_allowed_packet = 16M
|
||||||
|
thread_stack = 192K
|
||||||
##############
|
thread_cache_size = 8
|
||||||
# Networking #
|
myisam-recover = BACKUP
|
||||||
##############
|
query_cache_limit = 1M
|
||||||
|
query_cache_size = 16M
|
||||||
bind_address = <%= bind_address %>
|
|
||||||
port = <%= port %>
|
|
||||||
skip_name_resolve
|
|
||||||
skip_external_locking
|
|
||||||
max_allowed_packet = <%= max_allowed_packet %>
|
|
||||||
max_connections = <%= max_connections %>
|
|
||||||
wait_timeout = <%= wait_timeout %>
|
|
||||||
connect_timeout = <%= connect_timeout %>
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
|
||||||
# Logging #
|
|
||||||
###########
|
|
||||||
log_error = <%= log_error %>
|
log_error = <%= log_error %>
|
||||||
|
expire_logs_days = 10
|
||||||
<% if slow_query_log_file -%>
|
max_binlog_size = 100M
|
||||||
slow_query_log = 1
|
|
||||||
slow_query_log_file = <%= slow_query_log_file %>
|
|
||||||
long_query_time = <%= long_query_time %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
# Character Set
|
|
||||||
character_set_server = <%= character_set_server %>
|
|
||||||
collation_server = <%= collation_server %>
|
|
||||||
|
|
||||||
# Fulltext searches to find words smaller than <%= ft_min_word_len %> characters
|
|
||||||
ft_min_word_len = <%= ft_min_word_len %>
|
|
||||||
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Buffers, Threads, Caches, Limits #
|
|
||||||
####################################
|
|
||||||
tmp_table_size = <%= tmp_table_size %>
|
|
||||||
max_heap_table_size = <%= max_heap_table_size %>
|
|
||||||
max_tmp_tables = <%= max_tmp_tables %>
|
|
||||||
|
|
||||||
join_buffer_size = <%= join_buffer_size %>
|
|
||||||
read_buffer_size = <%= read_buffer_size %>
|
|
||||||
sort_buffer_size = <%= sort_buffer_size %>
|
|
||||||
|
|
||||||
table_cache = <%= table_cache %>
|
|
||||||
table_definition_cache = <%= table_definition_cache %>
|
|
||||||
open_files_limit = <%= open_files_limit %>
|
|
||||||
|
|
||||||
thread_stack = <%= thread_stack %>
|
|
||||||
thread_cache_size = <%= thread_cache_size %>
|
|
||||||
thread_concurrency = <%= thread_concurrency %>
|
|
||||||
|
|
||||||
query_cache_size = <%= query_cache_size %>
|
|
||||||
query_cache_limit = <%= query_cache_limit %>
|
|
||||||
tmp_table_size = <%= tmp_table_size %>
|
|
||||||
read_rnd_buffer_size = <%= read_rnd_buffer_size %>
|
|
||||||
|
|
||||||
<% if default_engine != 'UNSET' %>
|
<% if default_engine != 'UNSET' %>
|
||||||
default-storage-engine = <%= default_engine %>
|
default-storage-engine = <%= default_engine %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if ssl == true %>
|
<% if ssl == true %>
|
||||||
ssl-ca = <%= ssl_ca %>
|
ssl-ca = <%= ssl_ca %>
|
||||||
ssl-cert = <%= ssl_cert %>
|
ssl-cert = <%= ssl_cert %>
|
||||||
ssl-key = <%= ssl_key %>
|
ssl-key = <%= ssl_key %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
###################
|
|
||||||
# MyISAM Settings #
|
|
||||||
###################
|
|
||||||
key_buffer_size = <%= key_buffer_size %>
|
|
||||||
myisam_sort_buffer_size = <%= myisam_sort_buffer_size %>
|
|
||||||
myisam_max_sort_file_size = <%= myisam_max_sort_file_size %>
|
|
||||||
myisam_recover = <%= myisam_recover %>
|
|
||||||
|
|
||||||
|
|
||||||
###################
|
|
||||||
# InnoDB Settings #
|
|
||||||
###################
|
|
||||||
innodb_file_per_table = <%= innodb_file_per_table %>
|
|
||||||
innodb_status_file = <%= innodb_status_file %>
|
|
||||||
innodb_support_xa = <%= innodb_support_xa %>
|
|
||||||
innodb_flush_log_at_trx_commit = <%= innodb_flush_log_at_trx_commit %>
|
|
||||||
innodb_buffer_pool_size = <%= innodb_buffer_pool_size %>
|
|
||||||
innodb_log_file_size = <%= innodb_log_file_size %>
|
|
||||||
innodb_log_group_home_dir = <%= datadir %>
|
|
||||||
innodb_flush_method = <%= innodb_flush_method %>
|
|
||||||
innodb_thread_concurrency = <%= innodb_thread_concurrency %>
|
|
||||||
innodb_concurrency_tickets = <%= innodb_concurrency_tickets %>
|
|
||||||
innodb_doublewrite = <%= innodb_doublewrite %>
|
|
||||||
|
|
||||||
<% if replication_enabled -%>
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Replication Settings #
|
|
||||||
########################
|
|
||||||
log_bin = <%= bindir %>/bin
|
|
||||||
relay-log = <%= bindir %>/relay-bin
|
|
||||||
relay-log-index = <%= bindir %>/relay-bin.index
|
|
||||||
expire_logs_days = <%= expire_logs_days %>
|
|
||||||
max_binlog_size = <%= max_binlog_size %>
|
|
||||||
|
|
||||||
# Log slave updates so that any machine may be a master
|
|
||||||
log_slave_updates
|
|
||||||
|
|
||||||
# report as <%= hostname + '.' + port %> to master
|
|
||||||
report-host=<%= hostname + '.' + port %>
|
|
||||||
|
|
||||||
<% #automatically generate a unique master server-id from IP -%>
|
|
||||||
<% ia = ipaddress.split('.'); server_id = ia[0] + ia[2] + ia[3]; -%>
|
|
||||||
server-id = <%= server_id %>
|
|
||||||
|
|
||||||
<% replicate_ignore_db.each do |db| -%>
|
|
||||||
replicate_ignore_db = <%= db %>
|
|
||||||
<% end -%>
|
|
||||||
<% replicate_ignore_table.each do |table| -%>
|
|
||||||
replicate_ignore_table = <%= table %>
|
|
||||||
<% end -%>
|
|
||||||
<% replicate_do_db.each do |db| -%>
|
|
||||||
replicate_do_db = <%= db %>
|
|
||||||
<% end -%>
|
|
||||||
<% replicate_do_table.each do |table| -%>
|
|
||||||
replicate_do_table = <%= table %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<% end # if replication_enabled -%>
|
|
||||||
|
|
||||||
<% # set read_only mode based on read_only variable -%>
|
|
||||||
read_only = <%= read_only ? 1 : 0 %>
|
|
||||||
|
|
||||||
<% # render out any extra_configs as key = value pairs -%>
|
|
||||||
<% extra_configs.each do |key, value| -%>
|
|
||||||
<%= "#{key} = #{value}" %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
# This will be passed to all mysql clients
|
|
||||||
# It has been reported that passwords should be enclosed with ticks/quotes
|
|
||||||
# escpecially if they contain "#" chars...
|
|
||||||
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
|
|
||||||
[client]
|
|
||||||
port = <%= port %>
|
|
||||||
socket = <%= socket %>
|
|
||||||
|
|
||||||
[mysqldump]
|
[mysqldump]
|
||||||
quick
|
quick
|
||||||
quote-names
|
quote-names
|
||||||
max_allowed_packet = <%= max_allowed_packet %>
|
max_allowed_packet = 16M
|
||||||
|
|
||||||
[mysql]
|
[mysql]
|
||||||
#no-auto-rehash # faster start of mysql but no tab completition
|
[isamchk]
|
||||||
|
key_buffer = 16M
|
||||||
#
|
|
||||||
# * IMPORTANT: Additional settings that can override those from this file!
|
|
||||||
# The files must end with '.cnf', otherwise they'll be ignored.
|
|
||||||
#
|
|
||||||
!includedir /etc/mysql/conf.d/
|
!includedir /etc/mysql/conf.d/
|
||||||
|
|
Loading…
Reference in a new issue