Project

General

Profile

Actions

tickets #160086

closed

MySQL/Galera backups incomplete (again)

Added by crameleon 12 days ago. Updated 5 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Backup
Target version:
-
Start date:
2024-05-08
Due date:
% Done:

0%

Estimated time:

Description

In https://progress.opensuse.org/issues/155032 I resolved the missing database backups. Or so I thought.

Databases:

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| chocolate          |
| conference_osem    |
| etherpad           |
| information_schema |
| limesurvey         |
| matomo             |
| members            |
| mirrorcache        |
| mysql              |
| performance_schema |
| redmine            |
| redmine_test       |
| suse_hackweek      |
| sys                |
| webforums          |
| webforums2         |
| wiki_cn            |
| wiki_cs            |
| wiki_de            |
| wiki_el            |
| wiki_en            |
| wiki_en_test       |
| wiki_es            |
| wiki_fr            |
| wiki_hu            |
| wiki_it            |
| wiki_ja            |
| wiki_languages     |
| wiki_nl            |
| wiki_old_de        |
| wiki_old_en        |
| wiki_pl            |
| wiki_pt            |
| wiki_ru            |
| wiki_sv            |
| wiki_tr            |
| wiki_zh            |
| wiki_zh_tw         |
| wsrep              |
| xbttracker         |
+--------------------+
40 rows in set (0.001 sec)

Backup:

crameleon@mybackup:/home/crameleon> sudo ls -l /backup/20240504/
total 3069664
-rw-r----- 1 root root        852 May  4 03:00 chocolate.sql.xz
-rw-r----- 1 root root    4260248 May  4 03:00 conference_osem.sql.xz
-rw-r----- 1 root root  106788020 May  4 03:00 etherpad.sql.xz
-rw-r----- 1 root root     866524 May  4 03:02 limesurvey.sql.xz
-rw-r----- 1 root root 3030961632 May  4 03:03 matomo.sql.xz
-rw-r----- 1 root root       3782 May  4 03:00 my.cnf
drwxr-x--- 2 root root        164 May  4 03:00 my.cnf.d
-rw-r----- 1 root root     381988 May  4 03:19 mysql.sql.xz
-rw-r----- 1 root root       7768 May  4 03:19 percona.sql.xz
-rw-r----- 1 root root      44708 May  4 03:19 sys.sql.xz
-rw-r----- 1 root root        848 May  4 03:19 test.sql.xz

Related issues 2 (0 open2 closed)

Related to openSUSE admin - tickets #155032: MySQL/Galera backups incompleteResolvedcrameleon2024-02-07

Actions
Blocks openSUSE admin - tickets #160053: Request for old forums backup (vBulletin)Resolvedcrameleon2024-05-08

Actions
Actions #1

Updated by crameleon 12 days ago

  • Private changed from Yes to No
Actions #2

Updated by crameleon 12 days ago

It seems the issue is the MariaDB replica on mybackup.i.o.o only replicating some of the databases:

mybackup (DB backup):~ # mariadb
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| chocolate          |
| conference_osem    |
| etherpad           |
| information_schema |
| limesurvey         |
| matomo             |
| mysql              |
| percona            |
| performance_schema |
| sys                |
| test               |
+--------------------+
11 rows in set (0.006 sec)
Actions #3

Updated by crameleon 12 days ago

  • Status changed from New to In Progress

There don't seem to be any options which would exclude databases from the replication, hence unsure why it's incomplete. Will try to resync.

Actions #4

Updated by crameleon 12 days ago

Actions #5

Updated by crameleon 12 days ago

Actions #6

Updated by crameleon 11 days ago

It seems the full dump cannot be imported, because mybackup.i.o.o runs out of memory before completion.
The sync script does not handle this condition, and proceeds to configure the slave - which then happily replicates the few databases which did manage to get imported before the crash.

Actions #7

Updated by crameleon 11 days ago

I extended the old 256M swap partition with a 2GB swap file, and adjusted the import call:

- time mariadb < "$BACKUPFILE"
+ time mariadb -e "SET autocommit=0; SOURCE $BACKUPFILE; COMMIT;"

Now it no longer runs out of memory, but out of "disk" space on the MySQL tmpdir, which is configured to a 500M tmpfs, and hence memory as well ...

Actions #8

Updated by crameleon 11 days ago ยท Edited

  • Status changed from In Progress to Resolved

I tried it with a 8G swap file and zram as well, it only helped marginally. I presume it would need similar amounts of memory as the Galera nodes, but I don't think it's reasonable for a backup server to have such large amounts of memory if it's only needed for the initial import which we quite rarely need to do.

Since the dump logic is rather dated anyways, I now refactored the scripts to use Mariabackup and rsync instead:

galera1: /root/bin/backup_for_slave_sync_v2.sh
mybackup: /root/bin/restore_backup_v2.sh

This now works with barely any memory load, and feels much faster too.

For another task: we should manage these scripts in Salt or a package.

Actions

Also available in: Atom PDF