Commit Graph

49 Commits

Author SHA1 Message Date
Chi Wai, Chan 66f004c2ba Add an option to allow MySQL service to log to syslog.
This patch provides one of the alternative solution to address the
problem that the error log might grow too large.

Closes-bug: #1812950
Change-Id: If7c0c71492eb30f24cbcc03ca05a67e6ea571f4e
2022-06-28 13:53:16 +08:00
Nicholas Njihia 75fcf19f33 Add max_connect_errors configuration option.
This change adds the config option max_connect_errors for MySQL to this
charm and sets a default of 100.
Commit also includes the inclusion of this (default) config setting in the
unit tests.
Closes-Bug: #1776908

Change-Id: I33b9e29bd64ad8a1fec0edc3dfd657a87648b537
2021-09-02 18:15:22 +03:00
Robert Gildein 11ee1ef563 NRPE: Monitor threads connected to MySQL.
Add a NRPE check to monitor the number of threads connected
to the MySQL database, in proportion to the maximum number of connections.
For this check, a nagios user will be created. This user does not have any
permissions set, does not have access to any database and can only connect
from localhost.
Warning and Critical thresholds (in percentage) can be configured.

Add an action to reset nagios's password. This action could only be run
on the leader unit.

Closes-Bug: #1816759
Change-Id: Id35b0331322c2744a9f839b3eb153eed1bc53aac
2020-11-27 14:50:02 +00:00
Trent Lloyd 0697559b51 wsrep_slave_threads: default to 48 on bionic
This improves performance significantly for environments constrained by
calls to sync() such as HDDs or lower-end SSDs (or just very busy
environments running many queries)

By default the the queries from other nodes are only processed with
1 thread, which means they will always run slower than on the master and
any long running query will hold up all other queries behind it.

Additionally, when multiple queries commit at once the server can
combine them together into a single on-disk sync ('group commit') which
is not possible otherwise. This optimisation appears to only occur on
Bionic (Percona 5.7) and not Xenial (Percona 5.6).

On Bionic, default to 48 threads which experimentally is a good number
for OpenStack environments without being too crazy high. Galera ensures
that queries that are dependent on each other are still executed
sequentially and generally it is not expected to cause replication
inconsistencies.

However Percona Cluster 5.6 on Xenial appears to have a bug handling
foreign key constraints that causes them to be violated (LP #1823850).
The result is that the slave node crashes out and has to do a full SST
to recover. The same issue is not present on the master. Thus we leave
the default wsrep_slave_threads=1 on Xenial to avoid this issue for now
particularly since Xenial does not appear to be able to use Group Commit
to optimise the number of sync requests generated by the queries - so
this option does not really improve performance there anyway.

Partial-Bug: #1822903
Change-Id: Ic9cdd6562f30a3e52aa3d26fea53ba7c2bbdc771
2019-04-09 15:55:19 +08:00
Chris MacNaughton (icey) 0b190a679d Revert "Add support for autoeviction of slow nodes."
This reverts commit b96f7120c4.

Change-Id: Ib4693541bfae854a2f15323d8e114fedc057c2e6
2019-03-28 14:05:11 +00:00
Dimos Alevizos b96f7120c4 Add support for autoeviction of slow nodes.
Partial-Bug: 1815196

Change-Id: Ia3084c2a7eb8c4dc9b4eb7c6372369a5996f87b5
2019-03-27 07:21:31 +00:00
Xav Paice 7b7188b610 Add wsrep-slave-threads and gcs-fc-limit
These options allow tuning the Galera replication to avoid flow control from
slowing down the primary.

Change-Id: Ib275cae0db02e4c8c0a85fcc8cb138b26eb26982
Closes-Bug: 1799622
2018-12-17 18:08:24 +13:00
Tytus Kurek e116b1ef86 MySQL asynchronous replication
This patchset implements new relations: "master" and "slave" based
on a common "mysql-async-replication" interface which are used for
the purpose on enabling MySQL asynchronous replication between
multiple Percona XtraDB Clusters.

Change-Id: I94710bff17091516875c81ca769d8078ef5efd10
Closes-Bug: 1776171
2018-12-12 23:30:41 +01:00
Billy Olsen 7dc5fe5493 Remove lp1366997-workaround config option
The percona-cluster packages have been fixed in the package
repositories and no longer need this option to work around the
duplicate primary key error that this worked around. This patch
removes this option.

Change-Id: I493c64c3167b51399484f6fec75f674bfe53e2fb
Related-Bug: #1366997
2018-11-07 15:37:19 +00:00
Mario Splivalo 4ca460d56b Make pxc-strict-mode configurable via charm
PXC5.7, which is default one on bionic, introduces the new config
option, pxc_stric_mode, which is set to 'enforcing' by default.

This, however, prevents installing older versions of Openstack
with PXC5.7 on bionic (use case is, of course, testing).

This change makes pxc-strict-mode configurable via the charm, and
it defaults it to 'enforcing', but user can change it at hers or
his desire.

This option is going to be ignored on PXC installed on series less
than bionic.

Change-Id: I7d82e8bea2e75da6159b5baf2e88f2bd44ce84b3
2018-05-21 17:04:39 +00:00
David Ames 801c2e7829 Redesign cluster buildup process
In order to fix bug#1756928 the whole cluster buildup process needed to
be redesigned. The assumptions about what is_bootstrapped and clustered
meant and when to restart on configuration changed needed to be
re-evaluated.

The timing of restarts needed to be protected to avoid collisions.
Only bootstrapped hosts should go in to the
wsrep_cluster_address=gcomm:// setting. Adding or removing units should
be handled gracefully. Starting with a single unit and expanding to a
cluster must work.

This change guarantees mysqld is restarted when the configuration file
changes and meets all the above requirements. As a consequence of the redesign,
the workload status now more accurately reflects the state of the unit.

Charm-helpers sync to bring in distributed_wait fix.

Closes-Bug: #1756308
Closes-Bug: #1756928
Change-Id: I0742e6889b32201806cec6a0b5835e11a8027567
2018-03-29 09:24:05 -07:00
David Ames c82ca2be29 Allow setting gmcast.peer_timeout value
In some resource constrained environments particularly during deploy
time percona-cluster nodes can experience time outs during inter-node
communication.

This changes makes the gmcast.peer_timeout configurable based on the
galara cluster documentation:
http://galeracluster.com/documentation-webpages/galeraparameters.html

Warning: Changing this value from the default may have unintended
consequences. This should only be used when constraint's call for it.

Closes-Bug: #1742683
Change-Id: If93d6ba9d0e99b6af59358a7f3ea40e3aa2a6dbc
2018-02-06 16:05:07 -08:00
David Ames bd5474ce2f Avoid simultaneous restarts
It is possible for two or more percona-cluster units to simultaneously
attempt to restart and join the cluster. When this race condition
occurs one unit may error with:
"Failed to start mysql (max retries reached)"

We already have the control mechanism distributed_wait used in other
charms. This change implements this mechanism for percona-cluster.

Configuration options allow for fine tuning. The balance is time vs
tolerance for collision errors. CI systems may tolerate the occasion
false positive for time saved. Where production deployments can
sacrifice a bit of time for a guaranteed deploy.

Change-Id: I52e7f8e410ecd77a7a142d44b43414e33eff3a6e
Closes-Bug: #1745432
2018-01-25 15:20:29 -08:00
Edward Hope-Morley 5a03ac57e7 Cleanup config.yaml
Change-Id: I84b44d3152bb97abc4a6ca52ae14ed5becb6f4a8
2017-06-07 11:48:40 +01:00
James Page 60e58482f6 Improve password management for clustered deploys
In the past, its mandatory to provide the sst and root password
configuration options for clustered deployments to ensure consistent
use of passwords across the cluster from install onwards.

Rework password management and install process to seed passwords
from the lead unit if not supplied via configuration options.

Following units will defer installation until the leader has
stored this information in leader storage for retrieval by
followers.

Closes-Bug: 1454317

Change-Id: I5ab70cae78ed35322bf60048af841de071a69704
2017-03-08 10:07:52 +00:00
James Page bda27479a4 Add tuning-level configuration option
Inline with the mysql charm, add a tuning-level configuration option
that allows end users to change the configuration profile for PXC.

This option supports three values

   safest (default): use configuration options with best data
                     integrity guarantees.
   fast:             compromise some data integrity guarantees
                     to improve performance.
   unsafe:           pretty much throw away all data integrity
                     guarantees to maximise performance.

In clustered deployments, 'fast' and 'unsafe' may be appropriate to
use but should be considered carefully before reconfiguration away
from the default 'safest' option.

Right now, this option tweaks the innodb_flush_log_at_trx_commit
value for PXC:

   safest (default): 1
   fast:             2
   unsafe:           0

but should be used for other tuning optimizations that come along
in the future.

Also add direct configuration options for:

   innodb-change-buffering
   innodb-io-capacity

to allow end users to tweak other performance optimizations that
we can't yet do automatically using charm options.

This commit also includes a resync of charm-helpers, which includes
the fix to flush priviledges after adding grants to resolve bug
1513239.

Change-Id: I7c31e3bfbb825ae7091913e678dd1b7893892d1d
Closes-Bug: 1599222
Closes-Bug: 1513239
2017-03-03 15:00:56 +00:00
James Page 55154de2ee Ensure sane default memory configuration
Cap default memory consumption at 512MB or 50% of system memory -
whichever is the lowest - to ensure that deployments in containers
on large server infrastructure don't end up consuming silly
amounts of memory by default.

Update tests to not explicity configure dataset-size, and to
remove the constraint for a larger VM for testing - with the
performance schema disabled by default things should fit into
a default instance size in the gate.

Change-Id: Ifb9bd7e28e160190913f6bd03b84073a2857e4d7
2017-03-01 11:10:01 +00:00
David Ames e47c4ad135 Default performance schema to off
The 5.6 version of mysql defauls to performance_schema=on at server
startup. This allocates all the memory that would be required to
handle max-connections plus several other memory settings.

We occasionally saw connection exhaustion in HA clouds with
max-connections near 2000. The common practice became to set
max-connections unrealistically high near 10k or 20k. In the move to
5.6 on Xenial this became a problem as the memory requirements for
values that high are unrealistic.

This change adds performance schema as a configuration option and
defaults to off giving 5.5 like behavior. It also considerably
updates documentation and highlights the need to carefully consider
memory related configuration settings for production environments.

Make the amulet test python2 and python3 capable.

Change-Id: Id01095ac2f73fa041b25b2602496a4c04a13e3ef
Partial-Bug: #1654086
Closes-Bug: #1600001
2017-01-09 13:59:24 -08:00
James Page 14a093684a Increase default max-connections
The server compiled default of 151 is not very useful in anything
other than a single client deployment; increased the default
max-connections value to 600, which is much more useful.

Change-Id: I3e8c0fcc3e85ccf1990af77610401ebbd257b549
Closes-Bug: 1382386
2016-09-22 09:38:02 +01:00
Edward Hope-Morley 7d5c8963c3 Add new cluster-network config option
Adds support for specifying a cluster network. This allows
percona replication to be directed onto a specific network
as opposed to always being on the unit private-address network.

Change-Id: If35792f3c6f03533b44fc2c3eae0b192255349e4
Closes-Bug: 1599447
2016-07-14 23:28:23 +02:00
David Ames 7f3cfab538 DNS HA
Implement DNS high availability. Pass the correct information to
hacluster to register a DNS entry with MAAS 2.0 or greater rather
than using a virtual IP.

Charm-helpers sync to bring in DNS HA helpers

Change-Id: I2d9e2b92b0ebf33dc2f62327df6edbfd1e81dcca
2016-07-13 16:16:52 -07:00
Mario Splivalo f4af6f07c9 Enable configuring of mysql binlogs through charm
This change introduces 'enable-binlogs' and 'binlogs-path' charm
options so that binlogs can be configured through charms. Binlogs
are by default disabled.

Closes-Bug: 1424603
Change-Id: I437170506bbd7013f4884277ff863af2b485046b
2016-06-14 17:22:24 +02:00
Billy Olsen 2df091144b Add hardening support
Add charmhelpers.contrib.hardening and calls to install,
config-changed, upgrade-charm and update-status hooks. Also
add new config option to allow one or more hardening
modules to be applied at runtime.

Change-Id: I59afd73eace559f17f8a905da3c5d441942b6e95
2016-03-24 18:40:04 +00:00
JuanJo Ciarlante 4b8a5eda19 [jjo, r=] expose wsrep_sst_method, and defailt it to recommended value: xtrabackup-v2 as per URL at description 2015-10-29 09:30:18 -03:00
Edward Hope-Morley 8a00f580ee [trivial] config.yaml cleanup 2015-07-27 11:44:19 +02:00
Edward Hope-Morley 1373073fd2 [hopem,r=]
Add min-cluster-size config option. This allows the charm to wait
for a minimum number of peers to join before bootstrapping
percona and allowing relations to access the database.

Closes-Bug: 1475585
2015-07-22 12:17:09 +01:00
Jorge Niedbalski ee2e9ea0c0 Addressed @freyes comment 2015-06-04 12:11:31 -03:00
Jorge Niedbalski b5b8049c3b Fixes bug LP: #1461669 2015-06-04 11:40:54 -03:00
Liam Young 9741d11067 [brad-marshall, r=gnuoy] Add nrpe support to percona-cluster 2015-04-21 10:29:08 +01:00
Edward Hope-Morley 5532827444 [hopem,r=]
Adds missing 'key' config option required when using
'source' with private PPAs.

Closes-Bug: 1444412
2015-04-15 12:01:49 +01:00
JuanJo Ciarlante 5a20d34ce6 [jjo, r=] sync charmhelpers, then expose wait-timeout config 2015-03-04 12:30:55 -03:00
Brad Marshall 20c8ccda19 [bradm] Really fix text conflicts 2015-02-26 09:54:00 +10:00
Brad Marshall 2211f4642a [bradm] Add nagios checks 2015-02-19 15:14:15 +10:00
Mario Splivalo 98741b3ad0 Adds table-open-cache charm config option, as per lp1402586.
Also increases the default for table_open_cache to 2048, as the default
of 512 is a bit too low (and there is no repercussions with using larger
table cache).

Note: table_cache got renamed to table_open_cache in MySQL 5.1.3, but 
mysql-common didn't address that. Change is made in the charm now so
that future upgrades (from 5.5 to 5.6) can be smooth.
2015-02-16 15:12:42 +01:00
Mario Splivalo fc73b5b5b7 Reverting last commit 2015-02-11 21:16:48 +01:00
Mario Splivalo a34ec2d712 Changed the newly added option to more descriptive name. 2015-02-11 20:51:54 +01:00
Mario Splivalo 0095a80c58 Added lp1366997-workaround config option. It is disabled by default.
Enabling it will add two config options in my.cnf, as described
in lp1366997.
2015-02-10 13:07:57 +01:00
Mario Splivalo c0da3161ba Implements configuring innodb_file_per_table (fixes: lp1418570) 2015-02-06 10:48:02 +01:00
James Page 2ad775359f Add missing default keys 2014-12-15 13:22:24 +00:00
Edward Hope-Morley bdc0fda6ba Fixed minor typo in config.yaml 2014-09-25 17:43:44 +01:00
Edward Hope-Morley c002906c29 [hopem]
Adds ipv6 privacy extensions deploy note to config.yaml
2014-09-25 17:32:34 +01:00
Hui Xiang 721f6514f0 Do IPv6 check for supported version. 2014-09-18 22:48:05 +08:00
Hui Xiang 0074d79575 Support percona-cluster for ipv6. 2014-08-03 23:26:23 +08:00
James Page b3ed65d8de Tidy format of yaml 2014-07-02 10:35:12 +01:00
James Page fbfea46476 Resync network-split helpers 2014-07-02 09:32:44 +01:00
James Page 4de9fb2fe2 Deal with new in-distro stuff 2014-01-13 16:07:19 +00:00
James Page 5410686642 Rationalize configuration for percona/galera, add generic helpers for parsing mysql configuration options, use mysqlhelper for creation of SST user 2013-09-23 09:37:07 +01:00
James Page 30b31dc3f3 Lots of refactoring 2013-09-18 12:21:48 +01:00
James Page 159217d016 Add new hooks and config for VIP 2013-09-13 22:17:49 +01:00