class database { class { 'mysql::server': } package { 'mysqltuner': ensure => installed, } # See http://www.smilecouple.org/2011/03/01/fix-out-of-resource-problem-with-mysql file { '/etc/security/limits.d/mysql.conf': ensure => absent, owner => root, group => root, mode => '0644', content => "mysql soft nofile 24000\nmysql hard nofile 32000\n", } backupninja::mysql { "all_databases": backupdir => '/var/backups/mysql', compress => true, sqldump => true, sqldumpoptions => '--lock-tables --complete-insert --add-drop-table --quick --quote-names --single-transaction', } # # Tuning # # Avoid Errcode: 24 database::config { 'open-files-limit': value => hiera('database::open-files-limit', '500000'), } database::config { 'query_cache_size': value => hiera('database::query_cache_size', '64M'); 'query_cache_limit': value => hiera('database::query_cache_limit', '2M'); 'join_buffer_size': value => hiera('database::join_buffer_size', '256K'); 'key_buffer_size': value => hiera('database::key_buffer_size', '32M'); 'tmp_table_size': value => hiera('database::tmp_table_size', '64M'); 'max_heap_table_size': value => hiera('database::max_heap_table_size', '64M'); 'innodb_buffer_pool_size': value => hiera('database::innodb_buffer_pool_size', '256M'); 'table_open_cache': value => hiera('database::table_open_cache', '800'); } # Renamed to table_open_cache database::config { 'table_cache': value => hiera('database::table_cache', '800'), ensure => absent, } }