* Adding server_idparameter to mysql::config`

* Adding `sql_log_bin` parameter to `mysql::config`
* Adding `log_bin` parameter to `mysql::config`
* Adding `max_binlog_size` parameter to `mysql::config`
* Adding `binlog_do_db` parameter to `mysql::config`
* Adding `expire_logs_days` parameter to `mysql::config`
* Adding `log_bin_trust_function_creators` parameter to `mysql::config`
* Adding `replicate_ignore_table` parameter to `mysql::config`
* Adding `replicate_wild_do_table` parameter to `mysql::config`
* Adding `replicate_wild_ignore_table` parameter to `mysql::config`
* Adding `expire_logs_days`  parameter to `mysql::params`
* Adding `max_binlog_size` parameter to `mysql::params`
This commit is contained in:
Lebedev Vadim 2013-04-08 19:23:24 +04:00
parent 2a1b1e7962
commit 5ea8e5f920
4 changed files with 157 additions and 70 deletions

View file

@ -19,15 +19,14 @@
# [*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 # [*key_buffer] - Index blocks for MyISAM tables are buffered and
# are shared by all threads. key_buffer_size is the # are shared by all threads. key_buffer_size is the size of the buffer used
# size of the buffer used for index blocks. # for index blocks.
# [*max_allowed_packet] - The maximum size of one packet or any # [*max_allowed_packet] - The maximum size of one packet or any
# generated/intermediate string, or any # generated/intermediate string, or any parameter sent by the
# parameter sent by the mysql_stmt_send_long_data() # mysql_stmt_send_long_data() C API function.
# C API function.
# [*thread_stack] - The stack size for each thread. # [*thread_stack] - The stack size for each thread.
# [*thread_cache_size] - How many threads server should cache for reuse. # [*thread_cache_size] - How many threads server should cache for reuse.
# [*myisam-recover] - Set the MyISAM storage engine recovery mode. # [*myisam-recover] - Set the MyISAM storage engine recovery mode.
@ -40,12 +39,35 @@
# [*tmp_table_size] - The maximum size of internal in-memory temporary # [*tmp_table_size] - The maximum size of internal in-memory temporary
# tables. # tables.
# [*max_heap_table_size] - This variable sets the maximum size to which # [*max_heap_table_size] - This variable sets the maximum size to which
# user-created MEMORY tables are permitted to grow. # user-created MEMORY tables are permitted to grow.
# [*table_open_cache] - The number of open tables for all threads. # [*table_open_cache] - The number of open tables for all threads.
# [*long_query_time] - If a query takes longer than this many seconds, # [*long_query_time] - If a query takes longer than this many seconds,
# the server increments the Slow_queries status # the server increments the Slow_queries status variable.
# variable. # [*server_id] - The server ID, used in replication to give each
# # master and slave a unique identity.
# [*sql_log_bin] - This variable controls whether logging to the
# binary log is done. The default value is 1.
# [*log_bin] - Enable binary logging. The server logs all
# statements that change data to the binary log, which is used for backup
# and replication.
# [*max_binlog_size] - If a write to the binary log causes the current
# log file size to exceed the value of this variable, the server rotates
# the binary logs (closes the current file and opens the next one).
# [*binlog_do_db] - This option affects binary logging in a manner
# similar to the way that --replicate-do-db affects replication.
# [*expire_logs_days] - The number of days for automatic binary log file
# removal.
# [*log_bin_trust_function_creators] - It controls whether stored function
# creators can be trusted not to create stored functions that will cause
# unsafe events to be written to the binary log.
# [*replicate_ignore_table] - Tells the slave SQL thread not to
# replicate any statement that updates the specified table, even if any
# other tables might be updated by the same statement.
# [*replicate_wild_do_table] - Tells the slave thread to restrict
# replication to statements where any of the updated tables match the
# specified database and table name patterns.
# [*replicate_wild_ignore_table] - Tells the slave thread not to
# replicate a statement where any table matches the given wildcard pattern.
# #
# Actions: # Actions:
# #
@ -81,21 +103,29 @@ class mysql::config(
$restart = $mysql::params::restart, $restart = $mysql::params::restart,
$purge_conf_dir = false, $purge_conf_dir = false,
$key_buffer = $mysql::params::key_buffer, $key_buffer = $mysql::params::key_buffer,
$max_allowed_packet = $mysql::params::max_allowed_packet, $max_allowed_packet = $mysql::params::max_allowed_packet,
$thread_stack = $mysql::params::thread_stack, $thread_stack = $mysql::params::thread_stack,
$thread_cache_size = $mysql::params::thread_cache_size, $thread_cache_size = $mysql::params::thread_cache_size,
$myisam_recover = $mysql::params::myisam_recover, $myisam_recover = $mysql::params::myisam_recover,
$query_cache_limit = $mysql::params::query_cache_limit, $query_cache_limit = $mysql::params::query_cache_limit,
$query_cache_size = $mysql::params::query_cache_size, $query_cache_size = $mysql::params::query_cache_size,
$max_binlog_size = $mysql::params::max_binlog_size,
$max_connections = 'UNSET', $expire_logs_days = $mysql::params::expire_logs_days,
$tmp_table_size = 'UNSET', $max_connections = 'UNSET',
$max_heap_table_size = 'UNSET', $tmp_table_size = 'UNSET',
$table_open_cache = 'UNSET', $max_heap_table_size = 'UNSET',
$long_query_time = 'UNSET', $table_open_cache = 'UNSET',
$character_set = 'UNSET', $long_query_time = 'UNSET',
$character_set = 'UNSET',
$server_id = 'UNSET',
$sql_log_bin = 'UNSET',
$log_bin = 'UNSET',
$binlog_do_db = 'UNSET',
$log_bin_trust_function_creators = 'UNSET',
$replicate_ignore_table = 'UNSET',
$replicate_wild_do_table = 'UNSET',
$replicate_wild_ignore_table = 'UNSET',
) inherits mysql::params { ) inherits mysql::params {
File { File {

View file

@ -24,7 +24,8 @@ class mysql::params {
$myisam_recover = 'BACKUP' $myisam_recover = 'BACKUP'
$query_cache_limit = '1M' $query_cache_limit = '1M'
$query_cache_size = '16M' $query_cache_size = '16M'
$expire_logs_days = 10
$max_binlog_size = 100M
case $::operatingsystem { case $::operatingsystem {
'Ubuntu': { 'Ubuntu': {

View file

@ -3,27 +3,37 @@ 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', :key_buffer => '16M',
:max_allowed_packet => '16M', :max_allowed_packet => '16M',
:thread_stack => '256K', :thread_stack => '256K',
:thread_cache_size => 8, :thread_cache_size => 8,
:myisam_recover => 'BACKUP', :myisam_recover => 'BACKUP',
:query_cache_limit => '1M', :query_cache_limit => '1M',
:query_cache_size => '16M', :query_cache_size => '16M',
:character_set => 'UNSET', :max_binlog_size => '100M',
:max_connections => 'UNSET', :expire_logs_days => 10,
:tmp_table_size => 'UNSET', :character_set => 'UNSET',
:max_heap_table_size => 'UNSET', :max_connections => 'UNSET',
:table_open_cache => 'UNSET', :tmp_table_size => 'UNSET',
:long_query_time => 'UNSET', :max_heap_table_size => 'UNSET',
:table_open_cache => 'UNSET',
:long_query_time => 'UNSET',
:server_id => 'UNSET',
:sql_log_bin => 'UNSET',
:log_bin => 'UNSET',
:binlog_do_db => 'UNSET',
:log_bin_trust_function_creators => 'UNSET',
:replicate_ignore_table => 'UNSET',
:replicate_wild_do_table => 'UNSET',
:replicate_wild_ignore_table => 'UNSET',
} }
end end
@ -178,14 +188,16 @@ describe 'mysql::config' do
"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]}", "key_buffer = #{param_values[:key_buffer]}",
"max_allowed_packet = #{param_values[:max_allowed_packet]}", "max_allowed_packet = #{param_values[:max_allowed_packet]}",
"thread_stack = #{param_values[:thread_stack]}", "thread_stack = #{param_values[:thread_stack]}",
"thread_cache_size = #{param_values[:thread_cache_size]}", "thread_cache_size = #{param_values[:thread_cache_size]}",
"myisam-recover = #{param_values[:myisam_recover]}", "myisam-recover = #{param_values[:myisam_recover]}",
"query_cache_limit = #{param_values[:query_cache_limit]}", "query_cache_limit = #{param_values[:query_cache_limit]}",
"query_cache_size = #{param_values[:query_cache_size]}", "query_cache_size = #{param_values[:query_cache_size]}",
"expire_logs_days = #{param_values[:expire_logs_days]}",
"max_binlog_size = #{param_values[:max_binlog_size]}",
] ]
if param_values[:max_connections] != 'UNSET' if param_values[:max_connections] != 'UNSET'
expected_lines = expected_lines | [ "max_connections = #{param_values[:max_connections]}" ] expected_lines = expected_lines | [ "max_connections = #{param_values[:max_connections]}" ]
@ -208,6 +220,27 @@ describe 'mysql::config' do
if param_values[:character_set] != 'UNSET' if param_values[:character_set] != 'UNSET'
expected_lines = expected_lines | [ "character-set-server = #{param_values[:character_set]}" ] expected_lines = expected_lines | [ "character-set-server = #{param_values[:character_set]}" ]
end end
if param_values[:sql_log_bin] != 'UNSET'
expected_lines = expected_lines | [ "sql_log_bin = #{param_values[:sql_log_bin]}" ]
end
if param_values[:log_bin] != 'UNSET'
expected_lines = expected_lines | [ "log-bin = #{param_values[:log_bin]}" ]
end
if param_values[:binlog_do_db] != 'UNSET'
expected_lines = expected_lines | [ "binlog-do-db = #{param_values[:binlog_do_db]}" ]
end
if param_values[:log_bin_trust_function_creators] != 'UNSET'
expected_lines = expected_lines | [ "log_bin_trust_function_creators = #{param_values[:log_bin_trust_function_creators]}" ]
end
if param_values[:replicate_ignore_table] != 'UNSET'
expected_lines = expected_lines | [ "replicate-ignore-table = #{param_values[:replicate_ignore_table]}" ]
end
if param_values[:replicate_wild_do_table] != 'UNSET'
expected_lines = expected_lines | [ "replicate-wild-do-table = #{param_values[:replicate_wild_do_table]}" ]
end
if param_values[:replicate_wild_ignore_table] != 'UNSET'
expected_lines = expected_lines | [ "replicate-wild-ignore-table = #{param_values[:replicate_wild_ignore_table]}" ]
end
if param_values[:ssl] if param_values[:ssl]
expected_lines = expected_lines | expected_lines = expected_lines |
[ [

View file

@ -20,17 +20,18 @@ datadir = <%= datadir %>
tmpdir = /tmp tmpdir = /tmp
skip-external-locking skip-external-locking
<% if bind_address %> <% if bind_address -%>
bind-address = <%= bind_address %> bind-address = <%= bind_address %>
<% end %> <% end -%>
key_buffer = <%= key_buffer %>
key_buffer = <%= key_buffer %> max_allowed_packet = <%= max_allowed_packet %>
max_allowed_packet = <%= max_allowed_packet %> thread_stack = <%= thread_stack %>
thread_stack = <%= thread_stack %> thread_cache_size = <%= thread_cache_size %>
thread_cache_size = <%= thread_cache_size %> myisam-recover = <%= myisam_recover %>
myisam-recover = <%= myisam_recover %> query_cache_limit = <%= query_cache_limit %>
query_cache_limit = <%= query_cache_limit %> query_cache_size = <%= query_cache_size %>
query_cache_size = <%= query_cache_size %> expire_logs_days = <%= expire_logs_days %>
max_binlog_size = <%= max_binlog_size %>
<% if max_connections != 'UNSET' -%> <% if max_connections != 'UNSET' -%>
max_connections = <%= max_connections %> max_connections = <%= max_connections %>
@ -47,12 +48,34 @@ table_open_cache = <%= table_open_cache %>
<% if long_query_time != 'UNSET' -%> <% if long_query_time != 'UNSET' -%>
long_query_time = <%= long_query_time %> long_query_time = <%= long_query_time %>
<% end -%> <% end -%>
<% if server_id != 'UNSET' -%>
server-id = <%= server_id %>
<% end -%>
<% if sql_log_bin != 'UNSET' -%>
sql_log_bin = <%= sql_log_bin %>
<% end -%>
<% if log_bin != 'UNSET' -%>
log-bin = <%= log_bin %>
<% end -%>
<% if binlog_do_db != 'UNSET' -%>
binlog-do-db = <%= binlog_do_db %>
<% end -%>
<% if log_bin_trust_function_creators != 'UNSET' -%>
log_bin_trust_function_creators = <%= log_bin_trust_function_creators %>
<% end -%>
<% if replicate_ignore_table != 'UNSET' -%>
replicate-ignore-table = <%= replicate_ignore_table %>
<% end -%>
<% if replicate_wild_do_table != 'UNSET' -%>
replicate-wild-do-table = <%= replicate_wild_do_table %>
<% end -%>
<% if replicate_wild_ignore_table != 'UNSET' -%>
replicate-wild-ignore-table = <%= replicate_wild_ignore_table %>
<% end -%>
<% if log_error != 'syslog' -%> <% if log_error != 'syslog' -%>
log_error = <%= log_error %> log_error = <%= log_error %>
<% end -%> <% end -%>
expire_logs_days = 10
max_binlog_size = 100M
<% if default_engine != 'UNSET' %> <% if default_engine != 'UNSET' %>
default-storage-engine = <%= default_engine %> default-storage-engine = <%= default_engine %>
<% end -%> <% end -%>