Playing with Percona XtraDB Cluster in Docker

June 30, 2015
Author
Sveta Smirnova
Share this Post:

Like any good, thus lazy, engineer I don’t like to start things manually. Creating directories, configuration files, specify paths, ports via command line is too boring. I wrote already how I survive in case when I need to start MySQL server (here). There is also the MySQL Sandbox which can be used for the same purpose.

Playing with Percona XtraDB Cluster in DockerBut what to do if you want to start Percona XtraDB Cluster this way? Fortunately we, at Percona, have engineers who created automation solution for starting PXC. This solution uses Docker. To explore it you need:

 

    1. Clone the pxc-docker repository:
      git clone https://github.com/percona/pxc-docker

 

    1. Install Docker Compose as described here

 

    1. cd pxc-docker/docker-bld

 

    1. Follow instructions from the README file:

      a) ./docker-gen.sh 5.6 (docker-gen.sh takes a PXC branch as argument, 5.6 is default, and it looks for it on github.com/percona/percona-xtradb-cluster)

      b) Optional: docker-compose build (if you see it is not updating with changes).

      c) docker-compose scale bootstrap=1 members=2 for a 3 node cluster

       

 

    1. Check which ports assigned to containers:

      Now you can connect to MySQL clients as usual:

       

 

    1. To change MySQL options either pass it as a mount at runtime with something like volume: /tmp/my.cnf:/etc/my.cnf in docker-compose.yml or connect to container’s bash (docker exec -i -t container_name /bin/bash), then change my.cnf and run docker restart container_name

 

Notes.

 

 

    • If you don’t want to run Docker Compose as root user add yourself to docker group

 

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved