[Maria-discuss] Some questions about mariadb-dump and mariabackup
Hi! Sorry to bother you about this but I haven't found the answers in the doc. ** mariadb-dump Could you tell me what is the difference of calling mariadb-dump on innodb tables using --skip-lock-tables --single-transaction?
From what I read these seem to be time / performace optimizations for doing innodb tables dumps but if we omit them, we would get the same data dumped, even it takes longer.
Could you confirm this? ** mariabackup We have a setup that stores the binary logs under /var/log/mysql (set up with the log_bin configuration option) and the databases themselves under /var/lib/mysql Suppose I call mariabackup to make a backup of the database as follows (some options obmitted): mariabackup --backup --target-dir=my_backup_dir Could you tell me if calling mariabackup --prepare --target-dir=my_backup_dir needs access to the binary logs stored under /var/log/mysql or if mariabackup made a copy of all that it needs in my_backup_dir? ** mariabackup and incremental backups This is basically the same question as the above. If i'm making incremental backups as follows (some options obmitted): mariabackup --backup \ --target-dir=my_backup_dir/inc1 --incremental-basedir=full_backup_dir When I do the prepare for the incremental backups, does mariabackup need access to the /var/log/mysql bin logs or do the full + each incremental backup dirs has all the info needed to do the prepare? mariabackup --prepare \ --target-dir=my_backup_dir/inc1 --incremental-basedir=full_backup_dir Many thanks in advance! --josé
I will partially respond to your questions: -skip-lock-tables, avoids locking the table when dumping them. This means if you are on production servers, the dump won't freeze/slow your activity, however the dump may be incomplete or not reflecting an atomic state. -single-transaction This as far as I know is only the way the INSERT commands will be written to the dump. With multiple inserts or a single one. As for mariabackup, I don't think the prepare command needs access to the actual source folder, as everything has been copied. The prepare seems to replace the last bin log, but you might want to seek for someone else confirmation. FWIW, I stopped using mariabackup for backup (using it to start replication only) because restoring a single DB (we have 300+) or a single table seems highly cumbersome because you'll have to restore the entire backup to a working MariaDB server, and then dump/import the tables/DB you need onto your production server. Had to do it once, never again. So now I'm using plain mysqldump for which I easily control the output and how I'll be able to retrieve a DB or single table! -----Message d'origine----- De : Maria-discuss <maria-discuss-bounces+cedric.counotte=1check.com@lists.launchpad.net> De la part de jkmdb@w3.org Envoyé : mardi 2 août 2022 12:34 À : maria-discuss@lists.launchpad.net Objet : [Maria-discuss] Some questions about mariadb-dump and mariabackup Hi! Sorry to bother you about this but I haven't found the answers in the doc. ** mariadb-dump Could you tell me what is the difference of calling mariadb-dump on innodb tables using --skip-lock-tables --single-transaction?
From what I read these seem to be time / performace optimizations for doing innodb tables dumps but if we omit them, we would get the same data dumped, even it takes longer.
Could you confirm this? ** mariabackup We have a setup that stores the binary logs under /var/log/mysql (set up with the log_bin configuration option) and the databases themselves under /var/lib/mysql Suppose I call mariabackup to make a backup of the database as follows (some options obmitted): mariabackup --backup --target-dir=my_backup_dir Could you tell me if calling mariabackup --prepare --target-dir=my_backup_dir needs access to the binary logs stored under /var/log/mysql or if mariabackup made a copy of all that it needs in my_backup_dir? ** mariabackup and incremental backups This is basically the same question as the above. If i'm making incremental backups as follows (some options obmitted): mariabackup --backup \ --target-dir=my_backup_dir/inc1 --incremental-basedir=full_backup_dir When I do the prepare for the incremental backups, does mariabackup need access to the /var/log/mysql bin logs or do the full + each incremental backup dirs has all the info needed to do the prepare? mariabackup --prepare \ --target-dir=my_backup_dir/inc1 --incremental-basedir=full_backup_dir Many thanks in advance! --josé _______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
On Tue, Aug 2, 2022 at 2:47 PM Cédric Counotte <cedric.counotte@1check.com> wrote:
I will partially respond to your questions:
-skip-lock-tables, avoids locking the table when dumping them. This means if you are on production servers, the dump won't freeze/slow your activity, however the dump may be incomplete or not reflecting an atomic state.
-single-transaction This as far as I know is only the way the INSERT commands will be written to the dump. With multiple inserts or a single one.
Not quite. --skip-lock-tables dumps the data without locking the tables. You are telling MariaDB that you don't care if the tables are mutually consistent during the dump. The --single-transaction option means that it will grab a brief metadata lock and start a transaction, and then dump everything from within that transaction, thus ensuring that the dump is coherent and internally consistent, while still avoiding long table locking.
As for mariabackup, I don't think the prepare command needs access to the actual source folder, as everything has been copied. The prepare seems to replace the last bin log, but you might want to seek for someone else confirmation.
FWIW, I stopped using mariabackup for backup (using it to start replication only) because restoring a single DB (we have 300+) or a single table seems highly cumbersome because you'll have to restore the entire backup to a working MariaDB server, and then dump/import the tables/DB you need onto your production server. Had to do it once, never again. So now I'm using plain mysqldump for which I easily control the output and how I'll be able to retrieve a DB or single table!
Unfortunately, mysqldump/mariadbdump are completely useless for big databases. Anything more than about 50GB is just too painfully slow. There are usually better ways to achieve this with well thought out infrastructures unless your database sizes are very small.
** mariabackup
We have a setup that stores the binary logs under /var/log/mysql (set up with the log_bin configuration option) and the databases themselves under /var/lib/mysql
Suppose I call mariabackup to make a backup of the database as follows (some options obmitted):
mariabackup --backup --target-dir=my_backup_dir
Could you tell me if calling
mariabackup --prepare --target-dir=my_backup_dir
needs access to the binary logs stored under /var/log/mysql or if mariabackup made a copy of all that it needs in my_backup_dir?
No, it only needs access to the what is in the backup directory. What --prepare does is applies the redo log changes it buffered up during the backup to make the backup set fully consistent. There are no circumstances under which mariabackup will need access to binary replication logs.
participants (3)
-
Cédric Counotte
-
Gordan Bobic
-
jkmdb@w3.org