Online backup of the galera database must desynchronize the node before backup

This fix aims to desynchonize the current node of the galera database to
avoid receiving any writes or syncs from the master node while the
backup is being performed, ensuring the consistency of the dump.

This procedure is specified on the product manual [1].

Not a clean cherry pick due to different naming of the role directory.

[1] https://galeracluster.com/library/training/tutorials/galera-backup.html

Closes-Bug: #1934654

Change-Id: I879abd53a17402a0860557d8e0e31ab0c560fcd4
(cherry picked from commit dea5ae0569)
(cherry picked from commit bf60d71718)
(cherry picked from commit 69a4efe4bf)
This commit is contained in:
Juan Larriba 2021-07-05 11:15:25 +02:00
parent 5daaeac04c
commit 48c0d5ff85
1 changed files with 26 additions and 0 deletions

View File

@ -101,6 +101,19 @@
tags:
- bar_create_recover_image
- name: Galera desync the MySQL node
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -p -u root \
-p{{ mysql_password.stdout }} --execute 'SET GLOBAL wsrep_desync = ON'"
when:
- mysql_password.stderr is defined
- enabled_galera
- tripleo_backup_and_restore_enable_snapshots|bool or not tripleo_backup_and_restore_service_manager|bool
tags:
- bar_create_recover_image
no_log: "{{ tripleo_backup_and_restore_hide_sensitive_logs | bool }}"
- name: MySQL Grants backup
shell: |
set -o pipefail
@ -127,6 +140,19 @@
- bar_create_recover_image
no_log: "{{ not ((ansible_verbosity | int) >= 2) | bool }}"
- name: Galera sync the MySQL node
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -p -u root \
-p{{ mysql_password.stdout }} --execute 'SET GLOBAL wsrep_desync = OFF'"
when:
- mysql_password.stderr is defined
- enabled_galera
- tripleo_backup_and_restore_enable_snapshots|bool or not tripleo_backup_and_restore_service_manager|bool
tags:
- bar_create_recover_image
no_log: "{{ tripleo_backup_and_restore_hide_sensitive_logs | bool }}"
- name: Pause mysql.
command: "{{ tripleo_container_cli }} pause {{ tripleo_backup_and_restore_mysql_container }}"
when: