Commit Graph

45 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
Zuul eac7bceb0c Merge "Raise file limits to allow max-connections >4190" 2020-12-17 20:11:22 +00:00
Trent Lloyd 5952b3de01 Raise file limits to allow max-connections >4190
Install a systemd unit override with LimitNOFILE raised to the required
number based on the same calculation the server performs to ensure both
the requested max_connections and table_open_cache values can be met.

The MySQL server does make some attempt to do this itself when started
as root which worked under Xenial, however in Bionic the systemd service
is started as the mysql user with LimitNOFILE=5000. As a result, the
server cannot raise the limit itself and caps max-connections to 4190,
table-open-cache to 200 and logs a warning to that effect:
[Warning] Changed limits: max_connections: 4190 (requested 12000)

More background:
https://www.percona.com/blog/2017/10/12/open_files_limit-mystery/

Change-Id: I25b429cc9b4970e3d7ef39bb9e6d738fe943686f
Closes-Bug: #1905366
2020-11-30 19:50:16 +08: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
David Ames b73f5c4880 Mysqldump Action
Add the mysqldump and set-pxc-strict-mode actions to allow for dumping
databases in text form.

Change-Id: Ibb9c5e17d01c7bb1335d8a7c9087216af8d00b09
2020-02-28 22:57:19 +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
David Ames fe131a0aa6 Series Upgrade
Implement the series-upgrade feature allowing to move between Ubuntu
series.

Change-Id: If38bf1767c8e0c9242071140535b44e12c9f9759
2018-09-17 15:38:00 +02:00
David Ames 78d1df2d50 Set server_id when using binlogs
Percona-cluster was failing to start when enable-binlogs was set to
True due to missing server_id in the configuration.

Set the server_id to a unique, non-zero, positive number from 1 to
2**32 - 1.

Closes-Bug: #1772947
Change-Id: Id7da6dd8f27e364e0d5244e4ec33ae4645e4ef96
2018-05-30 10:37:27 -07: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
Corey Bryant 7d835b8674 Add support for PXC 5.7 and xtrabackup 2.4
Bionic will ship with Percona XtraDB Cluster 5.7 and a newer
version of Percona XtraBackup; the majority of charm changes
are associated with the use of native mysql{@} units for
bootstrap and startup of mysqld.

Co-Authored-By: James Page <james.page@ubuntu.com>
Change-Id: I50c5642e11393da3bc03de0ef0b9af4c32e9a0c9
2018-03-09 11:55:43 +00:00
James Page 4b62b587af Support expand->migrate->contract db migrations
In order to support rolling upgrades, OpenStack services
are moving to a trigger driven approach to db upgrade,
involving expand, migrate and contract phases.

This requires that the underlying db supports creation of
such triggers which requires that:

  log_bin_trust_function_creators = 1

in the MySQL global configuration.

Change-Id: Id2cf2dd5a0929270229541e6cd488cd1c0d6103e
Closes-Bug: 1750705
2018-02-21 17:48:08 +00:00
David Ames fac45afc60 Gate db{-admin} relations until cluster is ready
Percona-cluster was responding to db and db-admin relations before it
was ready. This led to the error: "WSREP has not yet prepared node for
application use."

This change applies the same gating share-db relation already has to db
and db-admin relations. It also condenses code used in both instances.

This change guarantees the rendered configuration will not
auto-bootstrap for non-leaders. This addresses Bug 1738896.

Closes-Bug: #1742683
Closes-Bug: #1738896
Change-Id: If525595fd109e6a738071a3f016b9c2eabec529e
2018-02-01 10:01:46 -08: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 8a6c49f249 Increase max_connect_errors for older PXC releases
Ubuntu 14.04 ships with PXC 5.5, which has a lower default
value for max_connect_errors (10 vs 100); bump this value
inline with later 5.6 release to avoid issues with connections
from clients getting blacklisted due to connection problems.

(NOTE: my.cnf is used on trusty, mysqld.cnf on xenial or later).

Change-Id: I5475c4e1b10cb638d0694c380714c468f8d78d46
Closes-Bug: 1564083
2017-03-02 12:56:28 +00:00
James Page ae533965d6 Disable hostname resolution
MySQL automatically attempts to resolve hostnames to IP addresses,
mapping to ACL entries for users; this adds overhead for each
connection, and when DNS is wonky in some way can cause access
issues.

Use 'skip-name-resolve' to ensure that only IP addresses are
used with checking ACL's.

Change-Id: Idf55ddc3090da97a96dd0bbc30fc845f65d1692c
Partial-Bug: 1599222
2017-01-25 09:27: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
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
James Page 265de656c8 Add wsrep_provider to configuration
For PXC on later Ubuntu releases, the wsrep provider never
actually gets set, resulting in un-clustered configurations.

Add the required wsrep_provider stanza to the mysqld.cnf
template to ensure that we actually deploy clustered PXC
instances when multiple units are used.

Change-Id: Ie0995be5151845382405396b63f404c9ea9a36ed
Closes-Bug: 1572604
2016-04-20 15:34:37 +01:00
James Page f42fb3d04d Drop workaround for pxc 5.6 - not required 2015-09-29 12:03:48 +01:00
James Page 5647e76cbb Revert changes to older config template 2015-09-18 15:00:57 +01:00
James Page d58ab06f16 Drop errant comment 2015-09-18 13:31:13 +01:00
James Page 3c1092d615 Fixup layout 2015-09-18 13:24:32 +01:00
James Page 1c3645663f Rework for >= vivid 2015-09-18 12:58:07 +01:00
James Page 990887d2e8 Switch to 0.0.0.0 2015-09-18 12:26:08 +01:00
James Page ae5ee98c98 Enable networking by default 2015-09-18 12:23:18 +01:00
James Page 2c31d7b136 Make datadir dynamic depending on ubuntu version 2015-09-18 11:52:48 +01:00
Jorge Niedbalski b5b8049c3b Fixes bug LP: #1461669 2015-06-04 11:40:54 -03:00
James Page 23dd36ab79 [freyes,r=james-page] Ensure VIP is tied to a good mysqld instance.
Re-license charm as GPL-2 for compatibility with bundled ocf script.
2015-04-20 11:53:43 +01:00
JuanJo Ciarlante 5a20d34ce6 [jjo, r=] sync charmhelpers, then expose wait-timeout config 2015-03-04 12:30:55 -03:00
Felipe Reyes 42f20eb8cc Create mysql resource to monitor the daemon
This new pcmkr resource will take care of keep running mysqld and if it can't
then it will migrate the vip to a node where it is.
2015-03-04 11:42:47 -03: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
Mario Splivalo 2030f1a94f Added mising template code, removed shutil, cleanup 2014-10-21 13:48:26 +02:00
Mario Splivalo 4204a9ee6e Added new wsrep_sst plugin, xtrabackup-v2-ipv6
This is basically copy of the old xtrabackup-v2 plugin, just
forcing IPv6 on socat call.

Fixes: https://bugs.launchpad.net/percona-xtradb-cluster/+bug/1380747
2014-10-14 12:06:26 +02:00
Hui Xiang 0074d79575 Support percona-cluster for ipv6. 2014-08-03 23:26:23 +08: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
James Page 4a9f194caa Initial charm 2013-09-03 17:52:02 +01:00