1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
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 => lookup('database::open-files-limit', undef, undef, '500000'),
}
database::config {
'query_cache_size': value => lookup('database::query_cache_size', undef, undef, '64M');
'query_cache_limit': value => lookup('database::query_cache_limit', undef, undef, '2M');
'join_buffer_size': value => lookup('database::join_buffer_size', undef, undef, '256K');
'key_buffer_size': value => lookup('database::key_buffer_size', undef, undef, '32M');
'tmp_table_size': value => lookup('database::tmp_table_size', undef, undef, '64M');
'max_heap_table_size': value => lookup('database::max_heap_table_size', undef, undef, '64M');
'innodb_buffer_pool_size': value => lookup('database::innodb_buffer_pool_size', undef, undef, '256M');
'table_open_cache': value => lookup('database::table_open_cache', undef, undef, '800');
}
# Renamed to table_open_cache
database::config { 'table_cache':
value => lookup('database::table_cache', undef, undef, '800'),
ensure => absent,
}
}
|