V
V
Vyacheslav Grachunov2018-02-24 20:03:56
MySQL
Vyacheslav Grachunov, 2018-02-24 20:03:56

How to make a copy of the database spinning in the docker (the storage itself on volume) using xtrabackup?

xtrabackup on the host
, it needs access to /var/run/mysqld/mysqld.sock
in the MariaDB container to copy the database Run
like this:

docker run --name 10.1.23-mariadb -p 3308:3306 -v /opt/test/mariadb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mariadb:10.1.23

Mounting /var/run/mysqld/ does not help - the file does not appear on the host and also disappears in the container - the database stops working.
How to organize all this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vyacheslav Grachunov, 2018-02-25
@Qwentor

In short like this:
and get a direct path to the
socket this is only for the test, and if there is such a configuration in real life - my.cnf can be generated by a script

A
Anton Shvets, 2018-02-24
@Xuxicheta

https://github.com/martin-helmich/docker-xtrabackup
may help
, but in general you can mount exactly /var/run/mysqld/mysqld.sock, but this file must already be before the container is started.

C
chupasaurus, 2018-02-24
@chupasaurus

Don't mix containers with host processes.
Mount the directory for backups in advance, run xtrabackup from the container.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question