Running Percona XtraBackup on Windows…in Docker

发布日期:2018-10-08 浏览次数: 10003 次
In this blog, we’ll look at running Percona XtraBackup on Windows via a Docker container.
The question whether Percona XtraBackup is available for Windows comes up every so often. While we are not planning to provide regular releases for Windows, I decided to share a way to run Percona XtraBackup in a Docker container (especially since Docker support for Windows has become more and more stable).
For this exercise, I created a playground Docker image: perconalab/percona-xtrabackup.
First, we need to prepare a few things to make it work:
Install Docker on Windows (the current version I am running is 17.03)
Enable the sharing of disk C in Docker settings
Find out the IP address MySQL is running on (192.168.1.122 in my case)
Grant backup-required privileges for the xtrabackup user:
GRANT RELOAD,PROCESS,LOCK TABLES,REPLICATION CLIENT ON *.* TO 'xtrabackup'@'192.%' IDENTIFIED by 'xtrapassword'
Now, let’s assume our datadir is in C:/mysqldata, and we want to backup to C:/mysqlbackup. Needless to say, that XtraBackup image must run on the same server as MySQL’s datadir (since XtraBackup needs to access the data to copy it).
Now to take a backup we execute:
docker run --rm -it -v //C/mysqldata:/var/lib/mysql -v //C/mysqlbackup:/xtrabackup_backupfiles perconalab/percona-xtrabackup --backup --host=192.168.1.122 --user=xtrabackup --password=xtrapassword
We find our backup in C:/mysqlbackup when it is done.
Enjoy!
Related
Docker automatic MySQL slave propagation
June 21, 2016
In "Docker"
Running Percona XtraDB Cluster in a multi-host Docker network
June 10, 2016
In "Docker"
Containing your logical backups: mydumper in docker
September 21, 2015
In "Docker"
Author
Vadim Tkachenko
Vadim Tkachenko co-founded Percona in 2006 and serves as its Chief Technology Officer. Vadim leads Percona Labs, which focuses on technology research and performance evaluations of Percona’s and third-party products. Percona Labs designs no-gimmick tests of hardware, filesystems, storage engines, and databases that surpass the standard performance and functionality scenario benchmarks. Vadim’s expertise in LAMP performance and multi-threaded programming help optimize MySQL and InnoDB internals to take full advantage of modern hardware. Oracle Corporation and its predecessors have incorporated Vadim’s source code patches into the mainstream MySQL and InnoDB products. He also co-authored the book High Performance MySQL: Optimization, Backups, and Replication 3rd Edition.
分享到:
×

微信扫一扫分享

XML 地图 | Sitemap 地图