Commit Graph

30 Commits

Author SHA1 Message Date
Alex Kavanagh 432c3f0be4 Ensure that nagios user gets created with a password
The associated bug is due to a change introduced in commit d55dcde
which was to ensure that the correct password update is used for
different versions of mysql (pre and post 5.7.5).  However, this change
has broken the nagios user creation due to not setting the password.

This patch creates the nagios user and passord at the same time.  The
updating of the password is only done if the account already exists.

The change also corrects the nagios password store in leader-settings to
the 'mysql-nagios.passwd' key instead of 'nagios-password'.  This was an
unfortuante error when the nagios change password was introduced.  The
charm detects if the 'nagios-password' key is used on charm-upgrade and
moves it to 'mysql-nagios.passwd'.  This enables the key to work with
the standard MySQLHelper functions.

Finally, the ALTER command (on percona) doesn't update non-InnoDB tables
and thus needs to be run for each unit when the nagios password is
changed via the action.  The changes in percona_utils.py enable this to
happen.

Whilst the change looks large it ONLY affects the nagios password parts
of the charm.

The related bug is a tracking bug to serve as a reminder to fix this in
charm-helpers and this charm (i.e. make the charm-helpers code work to
change a password for any user other than root, and then enable this
charm to use that code).

Change-Id: Ibc751bef7b4654ebffdf843c556b193373e6e80c
Related-Bug: #1925377
Closes-Bug: #1925042
2021-04-21 18:17:45 +01: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
Liam Young 8443c165f9 Notify clients of series upgrade
When the percona cluster is undergoing a series upgrade, clients
should suspend db activity in their hooks (like db migrations).

This change sents a notification of upgrade down the shared-db
relation which clients can then react to.

Change-Id: I5d8ed7d3935db5568c50f8d585e37a4d0cc6914f
2020-01-29 12:56:23 +00:00
David Ames b8c2213dfb Notify bootstrapped action
It turns out a subsequent required step after a cold boot bootstrap is
notifying the cluster of the new bootstrap UUID.

The notify-bootstrapped action should be run on a different node than
the one which ran the bootstrap-pxc action.

This action will ensure the cluster converges on the correct bootstrap
UUID.

A subsequent patch stacked on this one will include tests for the new
cold boot actions.

Change-Id: Idee12d5f7e28498c5ab6ccb9605f751c6427ac30
Partial-Bug: #1744393
2019-07-17 07:58:15 -07:00
David Ames b97a0971c2 Bootstrap action after a cold boot
After a cold boot, percona-cluster will require administrative
intervention. One node will need to bootstrap per upstream
Percona Cluster documentation:
https://www.percona.com/blog/2014/09/01/galera-replication-how-to-recover-a-pxc-cluster/

This change adds an action to bootstrap a single node. On the other
nodes systemd will be attempting to start percona. Once the bootstrapped
node is up the others will join automatically.

Change-Id: Id9a860edc343ee5dbd7fc8c5ce3b4420ec6e134e
Partial-Bug: #1744393
2019-07-10 14:51:25 -07:00
David Ames 681cdf8e45 Convert to python3
Convert the percona cluster charm to python3.

Remove Trusty testing.

Change-Id: Ia5ae43f16caffb5c4356d3f5616e0383e23b5f50
2019-07-08 07:41:48 -07:00
Alex Kavanagh (tinwood) 79d8a0f7b7 Revert "Convert the charm to Python 3"
It's broken at trusty and needs to be re-worked due to a lack of python3-mysqldb at trusty

This reverts commit 03f93dbc76.

Change-Id: I2b722014fc1ed5823635a6b45b3307326fd901af
2019-03-14 15:12:50 +00:00
Alex Kavanagh 03f93dbc76 Convert the charm to Python 3
Change-Id: I2bb250a4abbe58fe3953357332fa0fe16b432e1c
2019-03-12 15:12:59 +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
Trent Lloyd f19a766d43 Use correct SST password in backup action
The backup action currently retrieves the sst-password from the charm
configuration exclusively, instead of the leader settings where it is
usually stored when auto-generated.

Always retrieve the correct SST password using the
percona_utils._get_password function.

Change-Id: I06d36c13ecc48a942e559d09d94e7813a2254479
2018-06-22 13:15:36 +08: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 094873d629 Fix and tidy backup action
During refactoring of the actions codebase, the backup
action managed to miss getting the default 'args' parameter.

Add args parameter so the the backup action is functional again.

Enable pep8 checking of actions, tidy up issues.

Use boolean action options as real booleans, not as strings.

Change-Id: Ia75dd90ac31dce4009fd44f8c1d582814134e3d9
Closes-Bug: 1583898
2016-05-20 10:05:44 +01:00
Alex Kavanagh f756931899 Enhanced pause/resume for maintenance mode
Implemented pause/resume with checking whether the mysqld process
is running on the unit when paused.
Synced charm-helpers and modified charm-helpers-hooks.yaml to pull in
the relevant pause-helper modules plus ancillary stuff that
charmhelpers.contrib.openstack.utils depends on.

Change-Id: I510b2566bd44342cc19491b380186af0c87e080a
2016-04-05 14:46:03 +00:00
James Page 9e632ba1d6 Add Juju Network Space support
Juju 2.0 provides support for network spaces, allowing
charm authors to support direct binding of relations and
extra-bindings onto underlying network spaces.

Resync charm-helpers to pickup support for new charm hook
tools.

Update get_db_host function to attempt to use the network
space support with appropriate fallback if on an older
Juju version.

Add some unit tests to cover the new support.

Change-Id: I28ae4beab5329eb69baddce5715b7f049af65b06
2016-03-31 16:59:01 +01:00
Jill Rouleau 2bc5d6e2f9 Add backup action
Add a new action to backup the pxc database on a unit.

Backups by default are stored in /opt/backups/mysql and can
optionally be compressed and done as incremental backups.

Change-Id: I5c6ab9fd8be7cb6cdb2a26e849ec0b22d8d4f9a6
2016-03-04 10:13:53 +00:00
James Page a855ea60bb Normalize messages in actions 2015-10-10 09:19:59 -07:00
James Page 1b19f34c55 Rework assess_status location, call on service resume action 2015-10-10 09:07:05 -07:00
Ryan Beisner 8979124503 update makefile, add actions to lint checks, fix lint 2015-10-06 15:07:52 +00:00
Geoffrey J. Teale deebd0cc99 Add args parameter to pause and resume, just for consistency. 2015-08-19 15:58:16 +02:00
Geoffrey J. Teale 8baa1d8ad1 Pass argv to main instead of argv[1:] as we never invoke it with python, but use #! instead 2015-08-19 13:19:43 +02:00
Geoffrey J. Teale 611e506e0b Switch to symlinked actions instead of one file per action. 2015-08-19 11:26:45 +02:00
Geoffrey J. Teale 691bc99372 Tidy pause/resume messages. 2015-08-06 15:47:35 +02:00
Geoffrey J. Teale 2d9756de6e Combine hookenv and host imports 2015-08-06 15:46:33 +02:00
Geoffrey J. Teale aa55460f6b Use service_pause / service_resume 2015-08-04 16:14:28 +02:00
Geoffrey J. Teale d6cedfdc42 Correct another import typo 2015-08-04 14:53:49 +02:00
Geoffrey J. Teale ad85d1f305 Fix import typo 2015-08-04 14:21:42 +02:00
Geoffrey J. Teale 1c34da1ddf Change import style of hookenv and host 2015-08-04 10:48:39 +02:00
Geoffrey J. Teale cd64cf41e2 Use charmhelpers.core.host.service_* methods instead of using subprocess.check_call directly. 2015-08-04 09:38:31 +02:00
Geoffrey J. Teale 88f263f98b Add pause/resume actions. 2015-08-03 15:21:55 +02:00