Installs the Percona MySQL client and/or server components. Optionally installs the XtraBackup hot backup software.
The following platforms are supported by this cookbook, meaning that the recipes run on these platforms without error:
- Ubuntu
- Debian
percona
- The default recipe. This sets up the apt repository and install common packages.percona::client
- Installs the Percona MySQL client libraries.percona::server
- Installs and configures the Percona MySQL server daemon.percona::backup
- Installs and configures the Percona XtraBackup hot backup software.percona::access_grants
- Used internally to grant permissions for recipes.
This cookbook installs the Percona MySQL components if not present, and pulls updates if they are installed on the system.
This cookbook supports Encrypted Data Bags.
To use encrypted passwords, you must create an encrypted data bag. This cookbook assumes a data bag names "passwords", but you can override the name using the node[:percona][:encrypted_data_bag]
attribute.
This cookbook expects a "mysql" item and a "system" item.
The mysql item should contain entries for root, backup, and replicaiton. If no value is found, the cookbook will fall back to the default non-encrypted password.
The "system" item should contain an entry for the debian system user as specified in the node[:percona][:server][:debian_username]
attribute. If no such
entry is found, the cookbook will fall back to the default non-encrypted password.
Example: "passwords" data bag - this example assumes that node[:percona][:server][:debian_username]=spud
{ "mysql" : { "root" : "trywgFA6R70NO28PNhMpGhEvKBZuxouemnbnAUQsUyo=\n" "backup" : "eqoiudfj098389fjadfkadf=\n" "replication" : "qwo0fj0213fm9020fm2023fjsld=\n" }, "system" : { "spud" : "dwoifm2340f024jfadgfu243hf2=\n" } }
Above shows the encrypted password in the data bag. Check out the encrypted_data_bag_secret
setting in knife.rb
to setup your data bag
secret during bootstrapping.
node[:percona][:server][:role]
default: "standalone", options: "standalone", "master", "slave"node[:percona][:keyserver]
default: "keys.gnupg.net"node[:percona][:encrypted_data_bag]
default: "passwords"
node[:percona][:server][:username]
default: "mysql"node[:percona][:server][:datadir]
default: "/var/lib/mysql"node[:percona][:server][:includedir]
default: "/etc/mysql/conf.d/"node[:percona][:server][:tmpdir]
default: "/tmp"node[:percona][:server][:root_password]
default: "123-changeme"node[:percona][:server][:debian_username]
default: "debian-sys-maint"node[:percona][:server][:debian_password]
default: "123-changeme"node[:percona][:server][:socket]
default: "/var/run/mysqld/mysqld.sock"node[:percona][:server][:nice]
default: 0node[:percona][:server][:open_files_limit]
default: 16384node[:percona][:server][:hostname]
default: "localhost"node[:percona][:server][:basedir]
default: "/usr"node[:percona][:server][:pidfile]
default: "/var/run/mysqld/mysqld.pid"node[:percona][:server][:port]
default: 3306node[:percona][:server][:language]
default: "/usr/share/mysql/english"node[:percona][:server][:skip_external_locking]
default: truenode[:percona][:server][:net_read_timeout]
default: 120node[:percona][:server][:old_passwords]
default: 1node[:percona][:server][:bind_address]
default: "127.0.0.1"
node[:percona][:server][:key_buffer]
default: "16M"node[:percona][:server][:max_allowed_packet]
default: "64M"node[:percona][:server][:thread_stack]
default: "192K"node[:percona][:server][:query_alloc_block_size]
default: "16K"node[:percona][:server][:memlock]
default: falsenode[:percona][:server][:transaction_isolation]
default: "REPEATABLE-READ"node[:percona][:server][:tmp_table_size]
default: "64M"node[:percona][:server][:default_table_type]
default: "InnoDB"node[:percona][:server][:max_heap_table_size]
default: "64M"node[:percona][:server][:sort_buffer_size]
default: "8M"node[:percona][:server][:join_buffer_size]
default: "8M"node[:percona][:server][:thread_cache_size]
default: 16node[:percona][:server][:myisam_recover]
default: "BACKUP"node[:percona][:server][:back_log]
default: 50node[:percona][:server][:max_connections]
default: 30node[:percona][:server][:max_connect_errors]
default: 9999999node[:percona][:server][:table_cache]
default: 8192node[:percona][:server][:bulk_insert_buffer_size]
default: "64M"
node[:percona][:server][:query_cache_size]
default: "64M"node[:percona][:server][:query_cache_limit]
default: "2M"
node[:percona][:server][:sync_binlog]
default: 1node[:percona][:server][:slow_query_log]
default: "/var/log/mysql/mysql-slow.log"node[:percona][:server][:long_query_time]
default: 2node[:percona][:server][:server_id]
default: 1node[:percona][:server][:binlog_do_db]
default: ""node[:percona][:server][:expire_logs_days]
default: 10node[:percona][:server][:max_binlog_size]
default: "100M"node[:percona][:server][:binlog_cache_size]
default: "1M"node[:percona][:server][:log_bin]
default: ""node[:percona][:server][:log_slave_updates]
default: falsenode[:percona][:server][:log_warnings]
default: truenode[:percona][:server][:log_long_format]
default: false
node[:percona][:server][:replication][:read_only]
default: falsenode[:percona][:server][:replication][:host]
default: ""node[:percona][:server][:replication][:username]
default: ""node[:percona][:server][:replication][:password]
default: ""node[:percona][:server][:replication][:port]
default: 3306
node[:percona][:server][:myisam_sort_buffer_size]
default: "128M"node[:percona][:server][:myisam_max_sort_file_size]
default: "10G"node[:percona][:server][:myisam_repair_threads]
default: 1node[:percona][:server][:myisam_recover]
default: "BACKUP"
node[:percona][:server][:skip_bdb]
default: true
node[:percona][:server][:skip_innodb]
default: falsenode[:percona][:server][:innodb_additional_mem_pool_size]
default: "32M"node[:percona][:server][:innodb_buffer_pool_size]
default: "6G"node[:percona][:server][:innodb_data_file_path]
default: "ibdata1:1G:autoextend"node[:percona][:server][:innodb_file_per_table]
default: truenode[:percona][:server][:innodb_data_home_dir]
default: ""node[:percona][:server][:innodb_thread_concurrency]
default: 16node[:percona][:server][:innodb_flush_log_at_trx_commit]
default: 1node[:percona][:server][:innodb_fast_shutdown]
default: falsenode[:percona][:server][:innodb_log_buffer_size]
default: "8M"node[:percona][:server][:innodb_log_file_size]
default: "1G"node[:percona][:server][:innodb_log_files_in_group]
default: 2node[:percona][:server][:innodb_max_dirty_pages_pct]
default: 80node[:percona][:server][:innodb_flush_method]
default: "O_DIRECT"node[:percona][:server][:innodb_lock_wait_timeout]
default: 120
node[:percona][:backup][:configure]
default: falsenode[:percona][:backup][:username]
default: "backup"node[:percona][:backup][:password]
default: "123-changeme"
In some situation it is preferable to explicitly define the attributes needed in a my.cnf file. This is enabled by adding categories to the node[:percona][:conf]
attributes. All keys found in the node[:percona][:conf]
map will represent categories in the my.cnf file. Each category contains a map of attributes that will be written to the my.cnf file for that category. See the example for more details.
node[:percona][:conf][:mysqld][:slow_query_log_file] = '/var/lib/mysql/data/mysql-slow.log'
This configuration would write the mysqld category to the my.cnf file and have an attribute slow_query_log_file
whose value would be /var/lib/mysql/data/mysql-slow.log
[mysqld]
slow_query_log_file = /var/lib/mysql/data/mysql-slow.log
Author:: Phil Cohen ([email protected])
Copyright:: 2011-2012, Phil Cohen
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.