Skip to content

Add parameterization changes from wikipedia. #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 64 additions & 16 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,70 @@
# }
#
class mysql::config(
$root_password = 'UNSET',
$old_root_password = '',
$bind_address = $mysql::params::bind_address,
$port = $mysql::params::port,
$etc_root_password = $mysql::params::etc_root_password,
$service_name = $mysql::params::service_name,
$config_file = $mysql::params::config_file,
$socket = $mysql::params::socket,
$datadir = $mysql::params::datadir,
$ssl = $mysql::params::ssl,
$ssl_ca = $mysql::params::ssl_ca,
$ssl_cert = $mysql::params::ssl_cert,
$ssl_key = $mysql::params::ssl_key,
$log_error = $mysql::params::log_error,
$default_engine = 'UNSET',
$root_group = $mysql::params::root_group
$root_password = 'UNSET',
$old_root_password = '',
$bind_address = $mysql::params::bind_address,
$port = $mysql::params::port,
$etc_root_password = $mysql::params::etc_root_password,
$service_name = $mysql::params::service_name,
$config_file = $mysql::params::config_file,
$socket = $mysql::params::socket,
$datadir = $mysql::params::datadir,
$ssl = $mysql::params::ssl,
$ssl_ca = $mysql::params::ssl_ca,
$ssl_cert = $mysql::params::ssl_cert,
$ssl_key = $mysql::params::ssl_key,
$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',
$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 {

File {
Expand Down
55 changes: 51 additions & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,57 @@
#
class mysql::params {

$bind_address = '127.0.0.1'
$port = 3306
$etc_root_password = false
$ssl = false
$bind_address = '127.0.0.1'
$port = 3306
$etc_root_password = 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'
$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 {
"Ubuntu": {
Expand Down
196 changes: 165 additions & 31 deletions templates/my.cnf.erb
Original file line number Diff line number Diff line change
@@ -1,42 +1,176 @@
[client]
port = <%= port %>
socket = <%= socket %>
[mysqld_safe]
socket = <%= socket %>
nice = 0
###
#### This file managed by puppet.
###

#
# * IMPORTANT
# 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]
user = mysql
socket = <%= socket %>
port = <%= port %>
basedir = <%= basedir %>
datadir = <%= datadir %>
tmpdir = /tmp
skip-external-locking
bind-address = <%= bind_address %>
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
log_error = <%= log_error %>
expire_logs_days = 10
max_binlog_size = 100M
basedir = <%= basedir %>
datadir = <%= datadir %>
tmpdir = /tmp
socket = <%= socket %>
user = mysql


##############
# Networking #
##############

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 %>

<% if slow_query_log_file -%>
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' %>
default-storage-engine = <%= default_engine %>
default-storage-engine = <%= default_engine %>
<% end %>

<% if ssl == true %>
ssl-ca = <%= ssl_ca %>
ssl-cert = <%= ssl_cert %>
ssl-key = <%= ssl_key %>
ssl-ca = <%= ssl_ca %>
ssl-cert = <%= ssl_cert %>
ssl-key = <%= ssl_key %>
<% 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]
quick
quote-names
max_allowed_packet = 16M
max_allowed_packet = <%= max_allowed_packet %>

[mysql]
[isamchk]
key_buffer = 16M
#no-auto-rehash # faster start of mysql but no tab completition

#
# * 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/