In an LXD/ZFS system, what are some good ways (efficient, fast, convenient) to clone a mariadb database, so I can use it for testing?
I’ve been using two methods:
For small databases, I have two mariadb containers, a production one and a test one. I use mysqldump/mysql to copy a database from production to test (the traditional way).
For large databases, I use a separate mariadb instance per database, and I would clone the whole mariadb container. More precisely, I have the mariadb data and log filesystems separate from the container, so I would clone both the container and the database filesystems.
I wonder if I can do better for the case of many small databases in one container/filesystem. Is it better to always clone the whole mariadb instance, even if I only need a copy of a single small database? That would allow me to easily rollback the test database to a known state without disturbing anything else (though I would still need to stop and restart the mariadb server).
Ideally, I would like each database to have its own zfs filesystem so I could clone/rollback each database at will. Is this possible with mariadb?