diff --git a/README.md b/README.md index 4ee6852..ba3f6db 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,20 @@ mysql_table_cache: 64 mysql_thread_concurrency: 10 mysql_query_cache_limit: '1M' mysql_query_cache_size: '16M' -mysql_innodb_file_per_table: 'innodb_file_per_table' mysql_character_set_server: 'utf8' mysql_collation_server: 'utf8_general_ci' mysql_mysqldump_max_allowed_packet: '128M' mysql_isamchk_key_buffer: '16M' +# InnoDB tuning +mysql_innodb_file_per_table: 'innodb_file_per_table' +mysql_innodb_flush_method: 'fdatasync' +mysql_innodb_buffer_pool_size: '128M' +mysql_innodb_flush_log_at_trx_commit: 1 +mysql_innodb_lock_wait_timeout: 50 +mysql_innodb_log_buffer_size: '1M' +mysql_innodb_log_file_size: '5M' + # List of databases to be created (optional) mysql_databases: - name: foobar diff --git a/defaults/main.yml b/defaults/main.yml index a6a6966..5ca4a18 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,6 +23,15 @@ mysql_collation_server: 'utf8_general_ci' mysql_mysqldump_max_allowed_packet: '128M' mysql_isamchk_key_buffer: '16M' +# InnoDB tuning +mysql_innodb_file_per_table: 'innodb_file_per_table' +mysql_innodb_flush_method: 'fdatasync' +mysql_innodb_buffer_pool_size: '128M' +mysql_innodb_flush_log_at_trx_commit: 1 +mysql_innodb_lock_wait_timeout: 50 +mysql_innodb_log_buffer_size: '1M' +mysql_innodb_log_file_size: '5M' + # List of databases to be created mysql_databases: [] diff --git a/templates/etc_mysql_my.cnf.j2 b/templates/etc_mysql_my.cnf.j2 index 7d918a5..66a1329 100644 --- a/templates/etc_mysql_my.cnf.j2 +++ b/templates/etc_mysql_my.cnf.j2 @@ -23,7 +23,7 @@ datadir = /var/lib/mysql tmpdir = /tmp # language is for pre-5.5. In 5.5 it is an alias for lc_messages_dir. language = {{ mysql_language }} -bind-address= {{ mysql_bind_address }} +bind-address = {{ mysql_bind_address }} skip-external-locking @@ -60,6 +60,15 @@ max_binlog_size = 100M # ** InnoDB # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. # Read the manual for more InnoDB related options. There are many! +innodb_flush_log_at_trx_commit = {{ mysql_innodb_flush_log_at_trx_commit }} +innodb_buffer_pool_size = {{ mysql_innodb_buffer_pool_size }} +{% if mysql_innodb_flush_method != 'fdatasync': %} +innodb_flush_method = {{ mysql_innodb_flush_method }} +{% endif %} +innodb_lock_wait_timeout = {{ mysql_innodb_lock_wait_timeout }} +innodb_log_buffer_size = {{ mysql_innodb_log_buffer_size }} +innodb_log_file_size = {{ mysql_innodb_log_file_size }} +{{ mysql_innodb_file_per_table }} # ** Security Features # Read the manual, too, if you want chroot! @@ -70,7 +79,6 @@ max_binlog_size = 100M # ssl-cert=/etc/mysql/server-cert.pem # ssl-key=/etc/mysql/server-key.pem -{{ mysql_innodb_file_per_table }} character_set_server = {{ mysql_character_set_server }} collation_server = {{ mysql_collation_server }}