How to include "mariadb-dump" in the build? Best practices for backup?

Hello,

I have built MariaDB using the following command:

cmake . -DWITHOUT_DYNAMIC_PLUGINS=1 -DWITH_MARIABACKUP=0 -DPLUGIN_PERFSCHEMA=NO -DWITH_UNIT_TESTS=0

After the installation I realized I did not get any "mariadb-dump". I'm a novice when it comes to building things from source so excuse me for my lack of knowledge. So I have a few questions:

1) In what option/plugin do I get the "mariadb-dump" plugin? Is it part of the "mariabackup" plugin I excluded?

2) Is there a way to add plugins after a build and installation was complete? Or do I have to uninstall MariaDB completely and rebuild it? If a reinstall is needed, what's the recommended way of doing a clean uninstall of it (getting rid of all configuration files)?

I also have a question unrelated to the build and install process, which has to do with backups: I am building an ecommerce website and my database will include user accounts, product information and orders. I have made a bash script that will email me an attached .zip file using Amazon Web Services SES (Simple Email Service). Due to the limit of just 10 MB in an email attachment, I do not think it is feasible to use "mariabackup" because it appears it will copy the entire schema, or the entire data directory. After some time, this will become many hundreds of MB, or even GB.

I therefore plan to use "mariadb-dump" to only retrieve the last 24 hours of data in 3 tables. So when I perform backups, I will receive a file for yesterday's data (00:00:00 to 23:59:59). I know this is possible in "mariadb-dump", by using a WHERE clause.

My question is: is it possible to also do this in mariabackup? Imagine the following queries:

SELECT * FROM Orders WHERE created >= '2024-06-11 00:00:00' AND created <= '2024-06-11 23:59:59'
SELECT * FROM Users WHERE created >= '2024-06-11 00:00:00' AND created <= '2024-06-11 23:59:59'
SELECT * FROM Products WHERE created >= '2024-06-11 00:00:00' AND created <= '2024-06-11 23:59:59'

I would then get 3 separate sql files each day, which I compress (gzip), and send via email. This will reduce the amount of data I send, but it will make restores very tedious - but it's better than no backup.

There are some very knowledgable people here and I would like to know if you see "mariabackup" as a better choice for my case? I do not have any sFTP for example where I can upload it. In my case, I just want to get the backups to my home computer. Since I do not have it online 24/7, emailing seems to be the best option for me at this point. Is my way of backing up in small chunks a stupid idea? Should I rethink this?

The most critical data for me is the "Orders" table. The products and users not so much. Orders contain all purchases made by customers.

Thank you in advance!

Answer Answered by Vladislav Vaintroub in this comment.

You're asking many questions at once :)

My cmake command line is quite similar to yours, just I'd not build in the source directory, but anyway

In the build directory, this line

cmake --build . --target mariadb-dump

Will build your the mariadb-dump, starting maybe with 10.5 (before that, target was called mysqldump). Maybe you build an old version.

You can't exclude mariadb-dump from the build using CMake during configure step, there are no options for it.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.