Commit c9d7f47164aa3ce56a0e31f88601ea39e1c9fbda

Authored by Earth Ugat
1 parent 8f912fc9

Bump to v0.2.0.

Use MariaDB 10.0
Include triggers, routines, and events in mysqldump command.
Change some default values.
  1 +# 0.2.0
  2 +
  3 +Use MariaDB 10.0
  4 +
1 5 # 0.1.3
2 6
3 7 Add open_files_limit default, set to 19000
... ...
1 1 # cfe-mariadb-cookbook
2 2
3   -This installs MariaDB by default and initiates databases and users. It can also install a script that performs a backup of all those databases into a designated S3 bucket.
  3 +This installs MariaDB 10.0 by default and initiates databases and users. It can also install a script that performs a backup of all those databases into a designated S3 bucket.
4 4
5 5
6 6 The server is assumed to be using an IAM role with S3 bucket read/write access, instead of a physical credentials file.
... ...
... ... @@ -80,14 +80,19 @@ default['mariadb']['server_root_password'] = 'secretpassword'
80 80 default['mariadb']['mysqld']['bind_address'] = '127.0.0.1'
81 81 default['mariadb']['mysqld']['port'] = '3306'
82 82 default['mariadb']['install']['type'] = 'package'
83   -default['mariadb']['install']['version'] = '5.5'
  83 +default['mariadb']['install']['version'] = '10.0'
  84 +default['mariadb']['use_default_repository'] = true
84 85 default['mariadb']['forbid_remote_root'] = true
85 86 # io_capacity has to be roughly the IO capacity of the EC2 instance.
86 87 # buffer_pool_size can be increased to 75% (0.75) of RAM if dedicated server.
87   -default['mariadb']['innodb']['io_capacity'] = '30'
  88 +default['mariadb']['innodb']['io_capacity'] = '40'
88 89 default['mariadb']['innodb']['buffer_pool_size'] =
89 90 ( %x(free -m).split(' ')[7].to_i * 0.5 ).round.to_s
90   -default['mariadb']['mysqld']['open_files_limit'] = '19000'
  91 +# Set innodb_open_files value same as table_open_cache.
  92 +# But set open_files_limit as highest.
  93 +default['mariadb']['innodb']['open_files'] = '2000'
  94 +default['mariadb']['mysqld']['table_open_cache'] = '2000'
  95 +default['mariadb']['mysqld']['open_files_limit'] = '24000'
91 96
92 97 ## Tip:
93 98 ## For encrypted attributes like passwords,
... ...
... ... @@ -4,12 +4,12 @@ maintainer_email 'sysadmin @ chromedia.com'
4 4 license 'Apache License'
5 5 description 'Simplifies setup of MariaDB in Chromedia.'
6 6 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7   -version '0.1.3'
  7 +version '0.2.0'
8 8
9 9 {
10   - 'mariadb' => '0.2.12',
11   - 'mysql2_chef_gem' => '1.0.2',
12   - 'database' => '4.0.9',
  10 + 'mariadb' => '0.3.1',
  11 + 'mysql2_chef_gem' => '1.1.0',
  12 + 'database' => '5.1.2',
13 13 'awscli' => '1.0.1',
14 14 'cron' => '1.7.4'
15 15 }.each { |cb, ver| depends cb, '~> ' + ver }
... ...
... ... @@ -21,6 +21,9 @@
21 21 # Some notes:
22 22 # If the DB server is dedicated, it might be a good idea to
23 23 # add 'noatime' to the / disk's mount options.
  24 +# NOTE:
  25 +# Make sure the open files limit are enforced for the mysql process.
  26 +# If not, try restarting the mysql service for the config to take effect.
24 27
25 28 chef_gem 'chef-rewind' do
26 29 compile_time true if respond_to?(:compile_time)
... ... @@ -28,6 +31,7 @@ end
28 31 require 'chef/rewind'
29 32
30 33 mysql2_chef_gem 'default' do
  34 + gem_version '0.4.4'
31 35 action :install
32 36 end
33 37
... ...
... ... @@ -40,6 +40,7 @@ export_db() {
40 40 echo "$(date) : Export database ${1}."
41 41 "$mysqldump_bin" -h "$db_host" -P "$db_port" -C --opt \
42 42 --no-create-db --single-transaction --lock-tables \
  43 + --routines --events --triggers \
43 44 -u "$2" -p"$3" "$1" > "${bak_dir}/${4}"
44 45 }
45 46
... ...