...
- Check mariabackup version on localhost: mariabackup --version → mariabackup based on MariaDB server 10.3.25-MariaDB debian-linux-gnu (x86_64)
- Start docker container using this version: docker run -it mariadb:10.3.25 bash
- Check backup version in container: mariabackup --version ->mariabackup based on MariaDB server 10.3.25-MariaDB debian-linux-gnu (x86_64)
- Copy mariabackup command from the code above and replace variable with actual values: mariabackup --backup --target-dir=/tmp --user=root --password=root --host=host.docker.internal --port=3355 → 2021-05-19 11:55:10 0 [ERROR] InnoDB: File /var/lib/mysql/ib_logfile0: 'open' returned OS error 71. Cannot continue operation
210519 11:55:10 [ERROR] mysqld got signal 6 ; - Try the same command locally: sudo mariabackup --backup --target-dir=/tmp --user=root --password=***** --host=localhost --port=3355 →[00] 2021-05-19 11:03:32 completed OK!
- Create a new user on local mariadb server: create user backup identified by 'backup';
- Grant all privileges to backup: GRANT ALL PRIVILEGES ON *.* TO 'backup'@'%'; FLUSH PRIVILEGES;
- Re-try mariabackup from the container: mariabackup --backup --target-dir=/tmp --user=backup --password=backup --host=host.docker.internal --port=3355 → [ERROR] InnoDB: File /var/lib/mysql/ib_logfile0: 'open' returned OS error 71. Cannot continue operation
210519 10:07:59 [ERROR] mysqld got signal 6 ; - Run the command locally: sudo mariabackup --backup --target-dir=/tmp --user=backup --password=backup --host=localhost --port=3355 → [00] 2021-05-19 11:10:27 completed OK!
- Try using mysqldump in the container instead: mysqldump --all-databases --host=host.docker.internal --port=3355 --user=backup --password=backup → -- Dump completed on 2021-05-19 10:12:37
- Try mysqldump locally: sudo mysqldump --all-databases --host=localhost --port=3355 --user=backup --password=backup → -- Dump completed on 2021-05-19 11:15:24
- Try mysqldump in the container with the root user: mysqldump --all-databases --host=host.docker.internal --port=3355 --user=root --password=root → -- Dump completed on 2021-05-19 11:59:54
- If we may the /var/lib/mysql directory from the localhost to the container, then mariabackup works in the container: docker run -it -v /var/lib/mysql:/var/lib/mysql mariadb:10.3.25 bash → mariabackup --backup --target-dir=/tmp --user=root --password=root --host=host.docker.internal --port=3355 → [00] 2021-05-19 12:16:10 completed OK!
- Also works with the backup user when the directory is mapped : mariabackup --backup --target-dir=/tmp --user=backup --password=backup --host=host.docker.internal --port=3355 → [00] 2021-05-19 12:16:10 completed OK!
Conclusion
- mariabackup does not work remotley [MDEV-15075] unless the /var/lib/mysql directory from the database host can be mapped to the same directory in the container.
- mysqldump is a more reliable option.
...