Tweak MySQL logging configuration

For a galera replication we do not need binary logs, but we need binary logs in
case customer needs to perform MySQL backup. In this review we propose to limit
rotation period for 1 day, and set option to disable binary logging by default.

Change-Id: I001c87081a3b334eb8844abca60e468370ea5f24
Closes-Bug: #1533805
This commit is contained in:
Andrii Petrenko 2016-01-14 08:30:54 -08:00
parent 39aac5a938
commit 9660e49bdf
3 changed files with 28 additions and 2 deletions

View File

@ -63,6 +63,20 @@
# system at install time. NOTE: use_percona must be set to true for this to
# be used.
#
# [*binary_logs_enabled*]
# Set this value to true for enabling MySQL binary logging.
# Defaults to false
#
# [*binary_logs_period*]
# (optional) Set binary logrotation period in days.
# Defaults to 1
#
# [*binary_logs_maxsize*]
# (optional) If a write to the binary log causes the current log file
# size to exceed the value of this variable, the server rotates the
# binary logs (closes the current file and opens the next one). The
# minimum value is 4096 bytes. The maximum and default value is 512MB.
class galera (
$cluster_name = 'openstack',
$primary_controller = false,
@ -78,6 +92,9 @@ class galera (
$wsrep_sst_password = undef,
$use_percona = false,
$use_percona_packages = false,
$binary_logs_enabled = false,
$binary_logs_period = 1,
$binary_logs_maxsize = '512M',
) {
include galera::params

View File

@ -5,12 +5,15 @@ port=3307
max_connections=<%= @max_connections %>
default-storage-engine=innodb
binlog_format=ROW
log_bin=mysql-bin
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'
character-set-server=utf8
default-storage-engine=innodb
expire_logs_days=10
<% if @binary_logs_enabled -%>
log_bin=mysql-bin
expire_logs_days=<%= @binary_logs_period %>
max_binlog_size=<%= @binary_logs_maxsize %>
<% end -%>
skip-external-locking
<% if @skip_name_resolve -%>

View File

@ -62,6 +62,12 @@ describe manifest do
provider = nil
end
it {
should contain_file('/etc/mysql/conf.d/wsrep.cnf').without(
:content => /.*log_bin=mysql-bin.*/,
)
}
it {
should contain_haproxy_backend_status('mysql').with(
:url => url,