MySQL InnoDB configuration parameters
Bring the mysql-innodb-cluster charm up to feature parity with percona-cluster in regards to configuration parameters. Review and merge charmhelpers: https://github.com/juju/charm-helpers/pull/397 Change-Id: Icccacd371d4985efad92d38c51dcf21b617bf40f
This commit is contained in:
parent
ba3290f249
commit
6ee95cf447
115
src/config.yaml
115
src/config.yaml
|
@ -18,6 +18,76 @@ options:
|
|||
type: string
|
||||
description: Cluster name for the InnoDB cluster. Must be unique.
|
||||
default: jujuCluster
|
||||
auto-rejoin-tries:
|
||||
type: string
|
||||
default: "1000"
|
||||
description: |
|
||||
The number of tries instances make to rejoin the cluster after being
|
||||
expelled.
|
||||
innodb-buffer-pool-size:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
By default this value will be set according to 50% of system total
|
||||
memory or 512MB (whichever is lowest) but also can be set to any specific
|
||||
value for the system. Supported suffixes include K/M/G/T. If suffixed
|
||||
with %, one will get that percentage of system total memory allocated.
|
||||
innodb-change-buffering:
|
||||
type: string
|
||||
default: "all"
|
||||
description: |
|
||||
Configure whether InnoDB performs change buffering, an optimization
|
||||
that delays write operations to secondary indexes so that the I/O
|
||||
operations can be performed sequentially.
|
||||
.
|
||||
Permitted values include
|
||||
.
|
||||
none Do not buffer any operations.
|
||||
inserts Buffer insert operations.
|
||||
deletes Buffer delete marking operations; strictly speaking,
|
||||
the writes that mark index records for later deletion
|
||||
during a purge operation.
|
||||
changes Buffer inserts and delete-marking operations.
|
||||
purges Buffer the physical deletion operations that happen
|
||||
in the background.
|
||||
all The default. Buffer inserts, delete-marking
|
||||
operations, and purges.
|
||||
.
|
||||
For more details https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_change_bufferring
|
||||
innodb-io-capacity:
|
||||
type: int
|
||||
default: 200
|
||||
description: |
|
||||
Configure the InnoDB IO capacity which sets an upper limit on I/O
|
||||
activity performed by InnoDB background tasks, such as flushing pages
|
||||
from the buffer pool and merging data from the change buffer.
|
||||
.
|
||||
This value typically defaults to 200 but can be increased on systems
|
||||
with fast bus-attached SSD based storage to help the server handle the
|
||||
background maintenance work associated with a high rate of row changes.
|
||||
.
|
||||
Alternatively it can be decreased to a minimum of 100 on systems with
|
||||
low speed 5400 or 7200 rpm spindles, to reduce the proportion of IO
|
||||
operations being used for background maintenance work.
|
||||
.
|
||||
For more details https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_io_capacity
|
||||
innodb-file-per-table:
|
||||
type: boolean
|
||||
default: True
|
||||
description: |
|
||||
Turns on innodb_file_per_table option, which will make MySQL put each
|
||||
InnoDB table into separate .idb file. Existing InnoDB tables will remain
|
||||
in ibdata1 file - full dump/import is needed to get rid of large
|
||||
ibdata1 file
|
||||
tuning-level:
|
||||
type: string
|
||||
default: safest
|
||||
description: |
|
||||
Valid values are 'safest', 'fast', and 'unsafe'. If set to 'safest', all
|
||||
settings are tuned to have maximum safety at the cost of performance.
|
||||
'fast' will turn off most controls, but may lose data on crashes.
|
||||
'unsafe' will turn off all protections but this may be OK in clustered
|
||||
deployments.
|
||||
table-open-cache:
|
||||
type: int
|
||||
default: 2048
|
||||
|
@ -38,9 +108,44 @@ options:
|
|||
Consult a MySQL memory calculator like http://www.mysqlcalculator.com/ to
|
||||
understand memory resources consumed by connections.
|
||||
See also performance-schema.
|
||||
auto-rejoin-tries:
|
||||
type: string
|
||||
default: "1000"
|
||||
enable-binlogs:
|
||||
type: boolean
|
||||
default: False
|
||||
description: |
|
||||
The number of tries instances make to rejoin the cluster after being
|
||||
expelled.
|
||||
Turns on MySQL binary logs. The placement of the logs is controlled with
|
||||
the binlogs_path config option.
|
||||
binlogs-path:
|
||||
type: string
|
||||
default: /var/log/mysql/mysql-bin.log
|
||||
description: |
|
||||
Location on the filesystem where binlogs are going to be placed.
|
||||
Default mimics what mysql-common package would do for mysql.
|
||||
Make sure you do not put binlogs inside mysql datadir (/var/lib/mysql/)!
|
||||
binlogs-max-size:
|
||||
type: string
|
||||
default: 100M
|
||||
description: |
|
||||
Sets the max_binlog_size mysql configuration option, which will limit the
|
||||
size of the binary log files. The server will automatically rotate
|
||||
binlogs after they grow to be bigger than this value.
|
||||
Keep in mind that transactions are never split between binary logs, so
|
||||
therefore binary logs might get larger than configured value.
|
||||
binlogs-expire-days:
|
||||
type: int
|
||||
default: 10
|
||||
description: |
|
||||
Sets the expire_logs_days mysql configuration option, which will make
|
||||
mysql server automatically remove logs older than configured number of
|
||||
days.
|
||||
prefer-ipv6:
|
||||
type: boolean
|
||||
default: False
|
||||
description: |
|
||||
If True enables IPv6 support. The charm will expect network interfaces
|
||||
to be configured with an IPv6 address. If set to False (default) IPv4
|
||||
is expected.
|
||||
.
|
||||
NOTE: these charms do not currently support IPv6 privacy extension. In
|
||||
order for this charm to function correctly, the privacy extension must be
|
||||
disabled and a non-temporary address must be configured/available on
|
||||
your network interface.
|
||||
|
|
|
@ -92,6 +92,66 @@ def db_router_address(cls):
|
|||
return ch_net_ip.get_relation_ip("db-router")
|
||||
|
||||
|
||||
@charms_openstack.adapters.config_property
|
||||
def innodb_flush_log_at_trx_commit_adapter(cls):
|
||||
"""Determine the value for innodb_flush_log_at_trx_commit.
|
||||
|
||||
Call the MySQLConfigHelper get_innodb_flush_log_at_trx_commit helper to get
|
||||
the value for innodb_flush_log_at_trx_commit.
|
||||
|
||||
:param cls: Class
|
||||
:type cls: ConfigurationAdapter class
|
||||
:returns: Numeric innodb_flush_log_at_trx_commit value
|
||||
:rtype: int
|
||||
"""
|
||||
return mysql.get_mysql_config_helper().get_innodb_flush_log_at_trx_commit()
|
||||
|
||||
|
||||
@charms_openstack.adapters.config_property
|
||||
def innodb_change_buffering_adapter(cls):
|
||||
"""Determine the value for innodb_flush_log_at_trx_commit.
|
||||
|
||||
Call the MySQLConfigHelper get_innodb_change_buffering helper to get the
|
||||
value for innodb_change_buffering.
|
||||
|
||||
:param cls: Class
|
||||
:type cls: ConfigurationAdapter class
|
||||
:returns: string innodb_change_buffering value
|
||||
:rtype: str
|
||||
"""
|
||||
return mysql.get_mysql_config_helper().get_innodb_change_buffering()
|
||||
|
||||
|
||||
@charms_openstack.adapters.config_property
|
||||
def innodb_buffer_pool_size_adapter(cls):
|
||||
"""Determine the value for innodb_flush_log_at_trx_commit.
|
||||
|
||||
Call the MySQLConfigHelper innodb_buffer_pool_size helper to get the value
|
||||
for innodb_buffer_pool_size_adapter.
|
||||
|
||||
:param cls: Class
|
||||
:type cls: ConfigurationAdapter class
|
||||
:returns: Numeric innodb_buffer_pool_size value
|
||||
:rtype: int
|
||||
"""
|
||||
return mysql.get_mysql_config_helper().get_innodb_buffer_pool_size()
|
||||
|
||||
|
||||
@charms_openstack.adapters.config_property
|
||||
def binlog_expire_logs_seconds_adapter(cls):
|
||||
"""Determine the value for binlog_expire_logs_seconds.
|
||||
|
||||
From the binlogs-expire-days config option calculate the number of seconds.
|
||||
|
||||
:param cls: Class
|
||||
:type cls: ConfigurationAdapter class
|
||||
:returns: Numeric binlog_expire_logs_seconds value
|
||||
:rtype: int
|
||||
"""
|
||||
days = int(ch_core.hookenv.config("binlogs-expire-days"))
|
||||
return 60 * 60 * 24 * days
|
||||
|
||||
|
||||
class CannotConnectToMySQL(Exception):
|
||||
"""Exception when attempting to connect to a MySQL server.
|
||||
"""
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
# * Basic Settings
|
||||
#
|
||||
user = mysql
|
||||
# pid-file = /var/run/mysqld/mysqld.pid
|
||||
# socket = /var/run/mysqld/mysqld.sock
|
||||
pid-file = /var/run/mysqld/mysqld.pid
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
# port = 3306
|
||||
# datadir = /var/lib/mysql
|
||||
datadir = /var/lib/mysql
|
||||
|
||||
|
||||
# If MySQL is running as a replication slave, this should be
|
||||
|
@ -33,7 +33,7 @@ report_host = {{ options.cluster_address }}
|
|||
#
|
||||
# * Fine Tuning
|
||||
#
|
||||
key_buffer_size = 16M
|
||||
key_buffer_size = 32M
|
||||
# max_allowed_packet = 64M
|
||||
# thread_stack = 256K
|
||||
table_open_cache = {{ options.table_open_cache }}
|
||||
|
@ -44,7 +44,7 @@ table_open_cache = {{ options.table_open_cache }}
|
|||
myisam-recover-options = BACKUP
|
||||
|
||||
# max_connections = 151
|
||||
{% if max_connections != -1 -%}
|
||||
{% if options.max_connections != -1 -%}
|
||||
max_connections = {{ options.max_connections }}
|
||||
{% endif %}
|
||||
|
||||
|
@ -74,10 +74,13 @@ log_error = /var/log/mysql/error.log
|
|||
# The following can be used as easy to replay backup logs or for replication.
|
||||
# note: if you are setting up a replication slave, see README.Debian about
|
||||
# other settings you may need to change.
|
||||
# server-id = 1
|
||||
# log_bin = /var/log/mysql/mysql-bin.log
|
||||
{% if options.enable_binlogs -%}
|
||||
log_bin={{ options.binlogs_path }}
|
||||
{% endif %}
|
||||
|
||||
binlog_expire_logs_seconds = {{ options.binlog_expire_logs_seconds_adapter }}
|
||||
max_binlog_size = {{ options.binlogs_max_size }}
|
||||
# binlog_expire_logs_seconds = 2592000
|
||||
max_binlog_size = 100M
|
||||
# binlog_do_db = include_database_name
|
||||
# binlog_ignore_db = include_database_name
|
||||
#
|
||||
|
@ -96,3 +99,31 @@ gtid_mode = ON
|
|||
server_id = {{ options.server_id }}
|
||||
|
||||
skip_name_resolve = ON
|
||||
|
||||
#
|
||||
# * InnoDB
|
||||
#
|
||||
{% if options.innodb_file_per_table -%}
|
||||
# This enables storing InnoDB tables in separate .ibd files. Note that, however
|
||||
# existing InnoDB tables will remain in ibdata file(s) unles OPTIMIZE is run
|
||||
# on them. Still, the ibdata1 file will NOT shrink - a full dump/import of the
|
||||
# data is needed in order to get rid of large ibdata file.
|
||||
innodb_file_per_table = 1
|
||||
{% else -%}
|
||||
innodb_file_per_table = 0
|
||||
{% endif %}
|
||||
|
||||
# safest = 1 (default)
|
||||
# fast = 2
|
||||
# unsafe = 0
|
||||
innodb_flush_log_at_trx_commit = {{ options.innodb_flush_log_at_trx_commit_adapter }}
|
||||
|
||||
innodb_buffer_pool_size = {{ options.innodb_buffer_pool_size_adapter }}
|
||||
|
||||
{% if options.innodb_change_buffering -%}
|
||||
innodb_change_buffering = {{ options.innodb_change_buffering_adapter }}
|
||||
{% endif %}
|
||||
|
||||
{% if options.innodb_io_capacity -%}
|
||||
innodb_io_capacity = {{ options.innodb_io_capacity }}
|
||||
{% endif %}
|
||||
|
|
|
@ -2,14 +2,21 @@ charm_name: mysql-innodb-cluster
|
|||
configure:
|
||||
- zaza.openstack.charm_tests.keystone.setup.add_demo_user
|
||||
- full_model:
|
||||
- zaza.openstack.charm_tests.keystone.setup.add_demo_user
|
||||
- zaza.openstack.charm_tests.glance.setup.add_lts_image
|
||||
# The pause and resume test validates changing the R/W primary.
|
||||
# Running the keystone tests after the MySQLInnoDBClusterTests
|
||||
# validates DB functionality after a change in the R/W primary.
|
||||
tests:
|
||||
- zaza.openstack.charm_tests.mysql.tests.MySQLInnoDBClusterColdStartTest
|
||||
# Temporarily disabling the cold start tests due to
|
||||
# https://bugs.mysql.com/bug.php?id=97279
|
||||
#- zaza.openstack.charm_tests.mysql.tests.MySQLInnoDBClusterColdStartTest
|
||||
- zaza.openstack.charm_tests.mysql.tests.MySQLInnoDBClusterTests
|
||||
- zaza.openstack.charm_tests.keystone.tests.AuthenticationAuthorizationTest
|
||||
- full_model:
|
||||
#- zaza.openstack.charm_tests.mysql.tests.MySQLInnoDBClusterColdStartTest
|
||||
- zaza.openstack.charm_tests.mysql.tests.MySQLInnoDBClusterTests
|
||||
- zaza.openstack.charm_tests.keystone.tests.AuthenticationAuthorizationTest
|
||||
dev_bundles:
|
||||
gate_bundles:
|
||||
- eoan
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -28,7 +28,7 @@ deps =
|
|||
[testenv:build]
|
||||
basepython = python3
|
||||
commands =
|
||||
charm-build --log-level DEBUG -o {toxinidir}/build src {posargs}
|
||||
charm-build --log-level DEBUG --wheelhouse-overrides wheelhouse-overrides.txt -o {toxinidir}/build src {posargs}
|
||||
|
||||
[testenv:py3]
|
||||
basepython = python3
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
git+https://github.com/juju/charm-helpers.git#egg=charmhelpers
|
Loading…
Reference in New Issue