* Adding key_buffer
parameter to mysql::config
* Adding `thread_stack` parameter to `mysql::config` * Adding `thread_cache_size` parameter to `mysql::config` * Adding `myisam-recover` parameter to `mysql::config` * Adding `query_cache_limit` parameter to `mysql::config` * Adding `query_cache_size` parameter to `mysql::config` * Adding `max_connections` parameter to `mysql::config` * Adding `tmp_table_size` parameter to `mysql::config` * Adding `table_open_cache` parameter to `mysql::config` * Adding `long_query_time` parameter to `mysql::config` * Updating mysql_config spec tests * Fixing lint warnings
This commit is contained in:
parent
e3b6de2da2
commit
2a1b1e7962
4 changed files with 166 additions and 57 deletions
|
@ -2,25 +2,50 @@
|
||||||
#
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
#
|
#
|
||||||
# [*root_password*] - root user password.
|
# [*root_password*] - root user password.
|
||||||
# [*old_root_password*] - previous root user password,
|
# [*old_root_password*] - previous root user password,
|
||||||
# [*bind_address*] - address to bind service.
|
# [*bind_address*] - address to bind service.
|
||||||
# [*port*] - port to bind service.
|
# [*port*] - port to bind service.
|
||||||
# [*etc_root_password*] - whether to save /etc/my.cnf.
|
# [*etc_root_password*] - whether to save /etc/my.cnf.
|
||||||
# [*service_name*] - mysql service name.
|
# [*service_name*] - mysql service name.
|
||||||
# [*config_file*] - my.cnf configuration file path.
|
# [*config_file*] - my.cnf configuration file path.
|
||||||
# [*socket*] - mysql socket.
|
# [*socket*] - mysql socket.
|
||||||
# [*datadir*] - path to datadir.
|
# [*datadir*] - path to datadir.
|
||||||
# [*ssl] - enable ssl
|
# [*ssl] - enable ssl
|
||||||
# [*ssl_ca] - path to ssl-ca
|
# [*ssl_ca] - path to ssl-ca
|
||||||
# [*ssl_cert] - path to ssl-cert
|
# [*ssl_cert] - path to ssl-cert
|
||||||
# [*ssl_key] - path to ssl-key
|
# [*ssl_key] - path to ssl-key
|
||||||
# [*log_error] - path to mysql error log
|
# [*log_error] - path to mysql error log
|
||||||
# [*default_engine] - configure a default table engine
|
# [*default_engine] - configure a default table engine
|
||||||
# [*root_group] - use specified group for root-owned files
|
# [*root_group] - use specified group for root-owned files
|
||||||
# [*restart] - whether to restart mysqld (true/false)
|
# [*restart] - whether to restart mysqld (true/false)
|
||||||
# [*character-set] - You can change the default server and
|
# [*character-set] - You can change the default server and
|
||||||
# client character set
|
# client character set
|
||||||
|
# [*key_buffer] - Index blocks for MyISAM tables are buffered and
|
||||||
|
# are shared by all threads. key_buffer_size is the
|
||||||
|
# size of the buffer used for index blocks.
|
||||||
|
# [*max_allowed_packet] - The maximum size of one packet or any
|
||||||
|
# generated/intermediate string, or any
|
||||||
|
# parameter sent by the mysql_stmt_send_long_data()
|
||||||
|
# C API function.
|
||||||
|
# [*thread_stack] - The stack size for each thread.
|
||||||
|
# [*thread_cache_size] - How many threads server should cache for reuse.
|
||||||
|
# [*myisam-recover] - Set the MyISAM storage engine recovery mode.
|
||||||
|
# [*query_cache_limit] - Do not cache results that are larger than this
|
||||||
|
# number of bytes.
|
||||||
|
# [*query_cache_size] - The amount of memory allocated for caching query
|
||||||
|
# results.
|
||||||
|
# [*max_connections] - The maximum permitted number of simultaneous
|
||||||
|
# client connections.
|
||||||
|
# [*tmp_table_size] - The maximum size of internal in-memory temporary
|
||||||
|
# tables.
|
||||||
|
# [*max_heap_table_size] - This variable sets the maximum size to which
|
||||||
|
# user-created MEMORY tables are permitted to grow.
|
||||||
|
# [*table_open_cache] - The number of open tables for all threads.
|
||||||
|
# [*long_query_time] - If a query takes longer than this many seconds,
|
||||||
|
# the server increments the Slow_queries status
|
||||||
|
# variable.
|
||||||
|
#
|
||||||
#
|
#
|
||||||
# Actions:
|
# Actions:
|
||||||
#
|
#
|
||||||
|
@ -55,7 +80,22 @@ class mysql::config(
|
||||||
$root_group = $mysql::params::root_group,
|
$root_group = $mysql::params::root_group,
|
||||||
$restart = $mysql::params::restart,
|
$restart = $mysql::params::restart,
|
||||||
$purge_conf_dir = false,
|
$purge_conf_dir = false,
|
||||||
$character_set = 'UNSET',
|
|
||||||
|
$key_buffer = $mysql::params::key_buffer,
|
||||||
|
$max_allowed_packet = $mysql::params::max_allowed_packet,
|
||||||
|
$thread_stack = $mysql::params::thread_stack,
|
||||||
|
$thread_cache_size = $mysql::params::thread_cache_size,
|
||||||
|
$myisam_recover = $mysql::params::myisam_recover,
|
||||||
|
$query_cache_limit = $mysql::params::query_cache_limit,
|
||||||
|
$query_cache_size = $mysql::params::query_cache_size,
|
||||||
|
|
||||||
|
$max_connections = 'UNSET',
|
||||||
|
$tmp_table_size = 'UNSET',
|
||||||
|
$max_heap_table_size = 'UNSET',
|
||||||
|
$table_open_cache = 'UNSET',
|
||||||
|
$long_query_time = 'UNSET',
|
||||||
|
$character_set = 'UNSET',
|
||||||
|
|
||||||
) inherits mysql::params {
|
) inherits mysql::params {
|
||||||
|
|
||||||
File {
|
File {
|
||||||
|
|
|
@ -17,6 +17,14 @@ class mysql::params {
|
||||||
$etc_root_password = false
|
$etc_root_password = false
|
||||||
$ssl = false
|
$ssl = false
|
||||||
$restart = true
|
$restart = true
|
||||||
|
$key_buffer = '16M'
|
||||||
|
$max_allowed_packet = '16M'
|
||||||
|
$thread_stack = '256K'
|
||||||
|
$thread_cache_size = 8
|
||||||
|
$myisam_recover = 'BACKUP'
|
||||||
|
$query_cache_limit = '1M'
|
||||||
|
$query_cache_size = '16M'
|
||||||
|
|
||||||
|
|
||||||
case $::operatingsystem {
|
case $::operatingsystem {
|
||||||
'Ubuntu': {
|
'Ubuntu': {
|
||||||
|
|
|
@ -3,14 +3,27 @@ describe 'mysql::config' do
|
||||||
|
|
||||||
let :constant_parameter_defaults do
|
let :constant_parameter_defaults do
|
||||||
{
|
{
|
||||||
:root_password => 'UNSET',
|
:root_password => 'UNSET',
|
||||||
:old_root_password => '',
|
:old_root_password => '',
|
||||||
:bind_address => '127.0.0.1',
|
:bind_address => '127.0.0.1',
|
||||||
:port => '3306',
|
:port => '3306',
|
||||||
:etc_root_password => false,
|
:etc_root_password => false,
|
||||||
:datadir => '/var/lib/mysql',
|
:datadir => '/var/lib/mysql',
|
||||||
:default_engine => 'UNSET',
|
:default_engine => 'UNSET',
|
||||||
:ssl => false,
|
:ssl => false,
|
||||||
|
:key_buffer => '16M',
|
||||||
|
:max_allowed_packet => '16M',
|
||||||
|
:thread_stack => '256K',
|
||||||
|
:thread_cache_size => 8,
|
||||||
|
:myisam_recover => 'BACKUP',
|
||||||
|
:query_cache_limit => '1M',
|
||||||
|
:query_cache_size => '16M',
|
||||||
|
:character_set => 'UNSET',
|
||||||
|
:max_connections => 'UNSET',
|
||||||
|
:tmp_table_size => 'UNSET',
|
||||||
|
:max_heap_table_size => 'UNSET',
|
||||||
|
:table_open_cache => 'UNSET',
|
||||||
|
:long_query_time => 'UNSET',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -92,19 +105,25 @@ describe 'mysql::config' do
|
||||||
[
|
[
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
:service_name => 'dans_service',
|
:service_name => 'dans_service',
|
||||||
:config_file => '/home/dan/mysql.conf',
|
:config_file => '/home/dan/mysql.conf',
|
||||||
:service_name => 'dans_mysql',
|
:service_name => 'dans_mysql',
|
||||||
:pidfile => '/home/dan/mysql.pid',
|
:pidfile => '/home/dan/mysql.pid',
|
||||||
:socket => '/home/dan/mysql.sock',
|
:socket => '/home/dan/mysql.sock',
|
||||||
:bind_address => '0.0.0.0',
|
:bind_address => '0.0.0.0',
|
||||||
:port => '3306',
|
:port => '3306',
|
||||||
:datadir => '/path/to/datadir',
|
:datadir => '/path/to/datadir',
|
||||||
:default_engine => 'InnoDB',
|
:default_engine => 'InnoDB',
|
||||||
:ssl => true,
|
:ssl => true,
|
||||||
:ssl_ca => '/path/to/cacert.pem',
|
:ssl_ca => '/path/to/cacert.pem',
|
||||||
:ssl_cert => '/path/to/server-cert.pem',
|
:ssl_cert => '/path/to/server-cert.pem',
|
||||||
:ssl_key => '/path/to/server-key.pem'
|
:ssl_key => '/path/to/server-key.pem',
|
||||||
|
:character_set => 'utf8',
|
||||||
|
:max_connections => 1000,
|
||||||
|
:tmp_table_size => '4096M',
|
||||||
|
:max_heap_table_size => '4096M',
|
||||||
|
:table_open_cache => 2048,
|
||||||
|
:long_query_time => 0.5,
|
||||||
}
|
}
|
||||||
].each do |passed_params|
|
].each do |passed_params|
|
||||||
|
|
||||||
|
@ -155,15 +174,40 @@ describe 'mysql::config' do
|
||||||
it 'should have a template with the correct contents' do
|
it 'should have a template with the correct contents' do
|
||||||
content = param_value(subject, 'file', param_values[:config_file], 'content')
|
content = param_value(subject, 'file', param_values[:config_file], 'content')
|
||||||
expected_lines = [
|
expected_lines = [
|
||||||
"port = #{param_values[:port]}",
|
"port = #{param_values[:port]}",
|
||||||
"socket = #{param_values[:socket]}",
|
"socket = #{param_values[:socket]}",
|
||||||
"pid-file = #{param_values[:pidfile]}",
|
"pid-file = #{param_values[:pidfile]}",
|
||||||
"datadir = #{param_values[:datadir]}",
|
"datadir = #{param_values[:datadir]}",
|
||||||
"bind-address = #{param_values[:bind_address]}"
|
"bind-address = #{param_values[:bind_address]}",
|
||||||
|
"key_buffer = #{param_values[:key_buffer]}",
|
||||||
|
"max_allowed_packet = #{param_values[:max_allowed_packet]}",
|
||||||
|
"thread_stack = #{param_values[:thread_stack]}",
|
||||||
|
"thread_cache_size = #{param_values[:thread_cache_size]}",
|
||||||
|
"myisam-recover = #{param_values[:myisam_recover]}",
|
||||||
|
"query_cache_limit = #{param_values[:query_cache_limit]}",
|
||||||
|
"query_cache_size = #{param_values[:query_cache_size]}",
|
||||||
]
|
]
|
||||||
|
if param_values[:max_connections] != 'UNSET'
|
||||||
|
expected_lines = expected_lines | [ "max_connections = #{param_values[:max_connections]}" ]
|
||||||
|
end
|
||||||
|
if param_values[:tmp_table_size] != 'UNSET'
|
||||||
|
expected_lines = expected_lines | [ "tmp_table_size = #{param_values[:tmp_table_size]}" ]
|
||||||
|
end
|
||||||
|
if param_values[:max_heap_table_size] != 'UNSET'
|
||||||
|
expected_lines = expected_lines | [ "max_heap_table_size = #{param_values[:max_heap_table_size]}" ]
|
||||||
|
end
|
||||||
|
if param_values[:table_open_cache] != 'UNSET'
|
||||||
|
expected_lines = expected_lines | [ "table_open_cache = #{param_values[:table_open_cache]}" ]
|
||||||
|
end
|
||||||
|
if param_values[:long_query_time] != 'UNSET'
|
||||||
|
expected_lines = expected_lines | [ "long_query_time = #{param_values[:long_query_time]}" ]
|
||||||
|
end
|
||||||
if param_values[:default_engine] != 'UNSET'
|
if param_values[:default_engine] != 'UNSET'
|
||||||
expected_lines = expected_lines | [ "default-storage-engine = #{param_values[:default_engine]}" ]
|
expected_lines = expected_lines | [ "default-storage-engine = #{param_values[:default_engine]}" ]
|
||||||
end
|
end
|
||||||
|
if param_values[:character_set] != 'UNSET'
|
||||||
|
expected_lines = expected_lines | [ "character-set-server = #{param_values[:character_set]}" ]
|
||||||
|
end
|
||||||
if param_values[:ssl]
|
if param_values[:ssl]
|
||||||
expected_lines = expected_lines |
|
expected_lines = expected_lines |
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
[client]
|
[client]
|
||||||
port = <%= port %>
|
port = <%= port %>
|
||||||
socket = <%= socket %>
|
socket = <%= socket %>
|
||||||
<% if character_set != 'UNSET' %>
|
<% if character_set != 'UNSET' -%>
|
||||||
default-character-set = <%= character_set %>
|
default-character-set = <%= character_set %>
|
||||||
<% end -%>
|
<% end %>
|
||||||
[mysqld_safe]
|
[mysqld_safe]
|
||||||
socket = <%= socket %>
|
socket = <%= socket %>
|
||||||
nice = 0
|
nice = 0
|
||||||
|
@ -24,13 +24,30 @@ skip-external-locking
|
||||||
bind-address = <%= bind_address %>
|
bind-address = <%= bind_address %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
key_buffer = 16M
|
key_buffer = <%= key_buffer %>
|
||||||
max_allowed_packet = 16M
|
max_allowed_packet = <%= max_allowed_packet %>
|
||||||
thread_stack = 192K
|
thread_stack = <%= thread_stack %>
|
||||||
thread_cache_size = 8
|
thread_cache_size = <%= thread_cache_size %>
|
||||||
myisam-recover = BACKUP
|
myisam-recover = <%= myisam_recover %>
|
||||||
query_cache_limit = 1M
|
query_cache_limit = <%= query_cache_limit %>
|
||||||
query_cache_size = 16M
|
query_cache_size = <%= query_cache_size %>
|
||||||
|
|
||||||
|
<% if max_connections != 'UNSET' -%>
|
||||||
|
max_connections = <%= max_connections %>
|
||||||
|
<% end -%>
|
||||||
|
<% if tmp_table_size != 'UNSET' -%>
|
||||||
|
tmp_table_size = <%= tmp_table_size %>
|
||||||
|
<% end -%>
|
||||||
|
<% if max_heap_table_size != 'UNSET' -%>
|
||||||
|
max_heap_table_size = <%= max_heap_table_size %>
|
||||||
|
<% end -%>
|
||||||
|
<% if table_open_cache != 'UNSET' -%>
|
||||||
|
table_open_cache = <%= table_open_cache %>
|
||||||
|
<% end -%>
|
||||||
|
<% if long_query_time != 'UNSET' -%>
|
||||||
|
long_query_time = <%= long_query_time %>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
<% if log_error != 'syslog' -%>
|
<% if log_error != 'syslog' -%>
|
||||||
log_error = <%= log_error %>
|
log_error = <%= log_error %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
@ -38,15 +55,15 @@ expire_logs_days = 10
|
||||||
max_binlog_size = 100M
|
max_binlog_size = 100M
|
||||||
<% if default_engine != 'UNSET' %>
|
<% if default_engine != 'UNSET' %>
|
||||||
default-storage-engine = <%= default_engine %>
|
default-storage-engine = <%= default_engine %>
|
||||||
<% end %>
|
<% end -%>
|
||||||
<% if character_set != 'UNSET' %>
|
<% if character_set != 'UNSET' -%>
|
||||||
character-set-server = <%= character_set %>
|
character-set-server = <%= character_set %>
|
||||||
<% 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 -%>
|
||||||
|
|
||||||
[mysqldump]
|
[mysqldump]
|
||||||
quick
|
quick
|
||||||
|
|
Loading…
Reference in a new issue