With 100K+ views to date, our blog ‘MySQL on Docker: Understanding the Basics’ has become a popular go-to resource for MySQL users who are looking to get an initial understanding of and start experimenting with Docker. Ashraf Sharif, Senior Support Engineer at Severalnines and author of the blog, is now turning it into a live presentation for this new webinar, which we will run as a series that will accompany the blogs.
Docker is quickly becoming mainstream as a method to package and deploy self-sufficient applications in primarily stateless Linux containers. This could be a challenge though for a stateful service like a database. As a database user you might be asking yourself: How do I best configure MySQL in a container environment? What can go wrong? Should I even run my databases in a container environment? How does performance compare with e.g. running on virtual machines or bare-metal servers? How do I manage replicated or clustered setups, where multiple containers need to be created, upgraded and made highly available?
If you’re looking at taking your first steps with Docker for MySQL and if any of these questions sound familiar, then this webinar is made for you :-)
AGENDA
This webinar is for MySQL users who are Docker beginners and who would like to understand the basics of running a MySQL container on Docker. We are going to cover:
- Docker and its components
- Concept and terminology
- How a Docker container works
- Advantages and disadvantages
- Stateless vs stateful
- Docker images for MySQL
- Running a simple MySQL container
- The ClusterControl Docker image
- Severalnines on Docker Hub
SPEAKER
Ashraf Sharif is System Support Engineer at Severalnines. He was previously involved in hosting world and LAMP stack, where he worked as principal consultant and head of support team and delivered clustering solutions for large websites in the South East Asia region. His professional interests are on system scalability and high availability.
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Webinar slides: MySQL on Docker: Understanding the Basics
1. Copyright 2017 Severalnines AB
I'm Jean-Jérôme from the Severalnines Team and
I'm your host for today's webinar!
Feel free to ask any questions in the Questions
section of this application or via the Chat box.
You can also contact me directly via the chat box
or via email: info@severalnines.com during or
after the webinar.
Your host & some logistics
10. What is Docker?
Copyright 2012 Severalnines AB
● Lightweight application container platform.
● Each container has its own:
○ Filesystem
○ Process space
○ Network stack
● Use pre-built image.
● Advantages:
○ Rapid deployment
○ Greater density per host
○ Isolation
Docker Architecture
13. Docker Image - Introduction
Copyright 2012 Severalnines AB
● A template for Docker container.
● Create an image:
○ Commit the container's changes
○ Build from Dockerfile
● Share the image:
○ Save as tarball.
○ Push to registry:
■ Public - Docker Hub, Docker Store
■ Private, hosted - Quay, ECR, GCR, Bintray,
Artifactory
■ Private, self-hosted - Your own registry
# Save image to tarball
$ docker save -o mysql.tar abc
# Start your own Docker registry service
$ docker run -d -p 5000:5000 --name registry
registry:2
# Push image to Docker Hub
$ docker push myimage/mysql:5.7
14. Docker Image - Commit a Container
Copyright 2012 Severalnines AB
Host
# Save image to tarball
$ docker run -d --name=abc ubuntu:16.04
# Commit the changes (in another window)
$ docker commit abc myimage/mysql:5.7
# Push image to Docker Hub
$ docker exec -it abc /bin/bash
root@abc:/# apt-get update
root@abc:/# DEBIAN_FRONTEND=noninteractive apt-get
install -y mysql-server
root@abc:/# vi /etc/mysql/my.cnf
# Ubuntu 16.04 host
$ apt-get update
$ DEBIAN_FRONTEND=noninteractive apt-get install -y
mysql-server
$ vi /etc/mysql/my.cnf
# Run MySQL server as a process
$ mysqld --socket=/var/lib/mysql/mysqld.sock
--pid-file=/var/lib/mysql/mysqld.pid
Docker
# Run MySQL server as a container
$ docker run -d myimage/mysql:5.7 mysqld
--socket=/var/lib/mysql/mysqld.sock
--pid-file=/var/lib/mysql/mysqld.pid
15. Docker Image - Using Dockerfile
Copyright 2012 Severalnines AB
Host
# Build as image
$ docker build -t myimage/mysql:5.7 .
# vi Dockerfile
FROM ubuntu:16.04
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y
mysql-server
COPY my.cnf /etc/mysql/my.cnf
EXPOSE 3306
# Ubuntu 16.04 host
$ apt-get update
$ DEBIAN_FRONTEND=noninteractive apt-get install -y
mysql-server
$ vi /etc/mysql/my.cnf
# Run MySQL server as a process
$ mysqld --socket=/var/lib/mysql/mysqld.sock
--pid-file=/var/lib/mysql/mysqld.pid
Docker
# Run MySQL server as a container
$ docker run -d myimage/mysql:5.7 mysqld
--socket=/var/lib/mysql/mysqld.sock
--pid-file=/var/lib/mysql/mysqld.pid
# Create MySQL config file
$ vi my.cnf
16. Docker Image - Build an Image
Copyright 2012 Severalnines AB
# Get image size
$ docker images
REPOSITORY TAG SIZE
myimage/mysql 5.7 529MB
# Show created layers
$ docker history myimage/mysql:5.7
CREATED BY SIZE
/bin/sh -c #(nop) COPY file:e8163ef656b6da... 101B
/bin/sh -c DEBIAN_FRONTEND=noninteractive ... 370MB
/bin/sh -c apt-get update 39.1MB
/bin/sh -c #(nop) CMD ["/bin/bash"] 0B
/bin/sh -c mkdir -p /run/systemd && echo '... 7B
/bin/sh -c sed -i 's/^#s*(deb.*universe... 2.76kB
/bin/sh -c rm -rf /var/lib/apt/lists/* 0B
/bin/sh -c set -xe && echo '#!/bin/sh' >... 745B
/bin/sh -c #(nop) ADD file:39d3593ea220e68... 120MB
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
724179e94999
f6016aab25f1
d51f459239fb
Image: myimage/mysql:5.7
ubuntu:16.04
ad74af05f5a2
Dockerfile
17. Docker Image - Best Practice for MySQL
Copyright 2012 Severalnines AB
# Get image size
$ docker images
REPOSITORY TAG SIZE
mysql 5.6 299MB
mysql 5.7 412MB
# tail entrypoint.sh
...
...
exec mysqld "$@"
● Extend an existing image available in the registry,
instead of building a new one from scratch.
● The smaller the image size, the faster the deployment.
(Hint: alpine).
● If using an entrypoint script, ensure mysqld command
runs with "exec", indicating it's the primary process
that holds PID 1 inside container.
● General guidelines:
https://docs.docker.com/engine/userguide/eng-image/
dockerfile_best-practices/
# vi Dockerfile
FROM mysql:5.7
# vi Dockerfile
FROM ubuntu:16.04
RUN apt-get install {all MySQL stuff}
19. Docker Container - Run a Single
Container
Copyright 2012 Severalnines AB
# Run a MySQL container
$ docker run -d
--name my-test
--env MYSQL_ROOT_PASSWORD=mypassword
mysql
# Get the container layer size
$ docker ps -s
CONTAINER ID IMAGE NAMES SIZE
d51f459239fb mysql my-test 4B (virtual 412MB)
Image: docker.io/mysql:latest
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
ad74af05f5a2
d51f459239fb
0639788facc8
35369f9634e1
937bbdd4305a
my-test
Image layers
(RO)
412 MB
Container layers
(RW)
4 B
20. Docker Container - Run another
Container
Copyright 2012 Severalnines AB
# Run a MySQL container
$ docker run -d
--name my-test2
--env MYSQL_ROOT_PASSWORD=mypassword
mysql
# Get the container layer size
$ docker ps -s
CONTAINER ID IMAGE NAMES SIZE
d51f459239fb mysql my-test 4B (virtual 412MB)
e9de9ed50ced mysql my-test2 4B (virtual 412MB)
Image: docker.io/mysql
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
ad74af05f5a2
d51f459239fb
0639788facc8
35369f9634e1
937bbdd4305a
my-test
Image layers
(RO)
412 MB
Container
layers (RW)
4 B + 4 B
e9de9ed50ced
my-test2
21. Docker Container - Container Layer
Changes
Copyright 2012 Severalnines AB
# Operation 2 - Create a schema and table
$ docker exec -it my-test
mysql -uroot -pmypassword -e
'CREATE SCHEMA testdb; CREATE TABLE t1 (id INT PRIMARY
KEY AUTO_INCREMENT, data TEXT);'
Image: docker.io/mysql
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
ad74af05f5a2
d51f459239fb
0639788facc8
35369f9634e1
937bbdd4305a
my-test
c33a2b88395d
Copy-on-Write
(CoW)
416f2a97355f
Supported CoW file system & devices:
AUFS, Btrfs, Device Mapper, OverlayFS/Overlay2, ZFS, VFS
# Operation 1 - Update /etc/mysql/my.cnf
$ docker exec -it my-test vi /etc/mysql/my.cnf
1
2New
Branch
22. Docker Container - Application vs Data
Copyright 2012 Severalnines AB
Application Data
Stateless Stateful
Ephemeral Persistent
Independant Dependant
Frontend Backend
Web, API Database, File Storage
24. Docker Volume - Type
Copyright 2012 Severalnines AB
# Mount a named volume into container
-v mysql1-data:/var/lib/mysql
# Mount tmpfs into container
--tmpfs /tmp
● Bind mount:
○ A file or directory on the host machine is
mounted into a container.
○ You manage the directory’s contents.
● Named volume:
○ A new directory is created within Docker’s
storage directory.
○ Docker manages the directory’s contents.
○ Extensible via volume plugin.
● tmpfs:
○ Stored on host machine’s memory (or swap).
○ Linux only.
# Bind mount a directory into container
-v /data/mysql1/data:/var/lib/mysql
# Bind mount a file into container
-v /data/mysql1/my.cnf:/etc/mysql/my.cnf
25. Docker Volume - Persistent
Volumes
Copyright 2012 Severalnines AB
# Run with persistent named volume, using -v or --volume
$ docker run -d
--name mysql-local
--env MYSQL_ROOT_PASSWORD=mypassword
--volume local-datadir:/var/lib/mysql
mysql:5.7
Image: docker.io/mysql:5.7
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
ad74af05f5a2
0639788facc8
35369f9634e1
937bbdd4305a
mysql-local
416f2a92355f
/var/lib/mysql
local-datadir
# Run with persistent named volume, using --mount
$ docker run -d
--name mysql-local
--env MYSQL_ROOT_PASSWORD=mypassword
--mount source=local-datadir,target=/var/lib/mysql
mysql:5.7
26. Docker Volume - Changes on
Volume
Copyright 2012 Severalnines AB
# Run a container with port 3308
$ docker run -d
--name mysql-local
-p 3308:3306
-e MYSQL_ROOT_PASSWORD=mypassword
-v local-datadir:/var/lib/mysql
mysql
Image: docker.io/mysql:latest
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
ad74af05f5a2
0639788facc8
35369f9634e1
937bbdd4305a
mysql-local
416f2a92355f
/var/lib/mysql
local-datadir
# Run with persistent named volume, using --mount
$ mysql -uroot -p -h127.0.0.1 -P3308 < dump.sql
dump
.sql
3308
27. Docker Volume - Remote Volume
Copyright 2012 Severalnines AB
# Run a container with NFS bind mount
$ docker run -d
--name mysql-nfs
-p 3308:3306
-e MYSQL_ROOT_PASSWORD=mypassword
-v /nfs/mysql-nfs:/var/lib/mysql
mysql
Image: docker.io/mysql
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
ad74af05f5a2
0639788facc8
35369f9634e1
937bbdd4305a
mysql-nfs
416f2a92355f
/var/lib/mysql
192.168.1.100
/storage/docker
# Mount NFS with extra options for MySQL
$ mount 192.168.1.100:/storage/docker /nfs -o
noatime,nodiratime,hard,intr
3308
/nfs/mysql-nfs
Further Reading - Using NFS with MySQL:
https://dev.mysql.com/doc/refman/5.7/en/disk-issues.htm
l#disk-issues-nfs
28. Docker Volume - MySQL Persistency
Copyright 2012 Severalnines AB
Description Variable Name Default Value (5.7)
MySQL data directory datadir /var/lib/mysql
MySQL plugin directory plugin_dir {basedir}/lib/plugin
MySQL configuration directory config_dir /etc/my.cnf.d
MySQL binary log log_bin {datadir}/{hostname}-bin
Slow query log slow_query_log_file {datadir}/{hostname}-slow.log
Error log log_error {datadir}/{hostname}.err
General log general_log_file {datadir}/{hostname}.log
29. Docker Volume - Non-Persistent
Volume
Copyright 2012 Severalnines AB
# Run a container with NFS bind mount and tmpfs volumes
$ docker run -d
--name mysql-nfs-tmp
-p 3308:3306
-e MYSQL_ROOT_PASSWORD=mypassword
-v /nfs/mysql-nfs:/var/lib/mysql
--tmpfs /tmp:rw,size=1g,mode=177
mysql
Image: docker.io/mysql:latest
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
ad74af05f5a2
0639788facc8
35369f9634e1
937bbdd4305a
mysql-nfs-tmp
416f2a92355f
/var/lib/mysql
192.168.1.100
/storage/docker
3308
/nfs/mysql-nfs
/tmp
30. Docker Volume - Drivers
Copyright 2012 Severalnines AB
● Default is local.
● You can use other different volume driver (or plugin).
○ Install the plugin.
○ Use --volume-driver option.
● Volume drivers allow you to extend Docker's volume
capabilities:
○ Snapshot
○ Backup
○ Encryption
# Install Rexray EBS docker plugin
$ docker plugin install rexray/ebs EBS_ACCESSKEY=XXXX
EBS_SECRETKEY=YYYY
# Verify if the plugin is loaded
$ docker info -f '{{json .Plugins.Volume}}' | jq
[
"local",
"rexray"
]
# Run a container with volume plugin
$ docker run -d
--name=mysql-ebs
--volume-driver=rexray/ebs
-v ebs-datadir:/var/lib/mysql
mysql:5.7
# List volumes
$ docker volume ls
DRIVER VOLUME NAME
local local-datadir1
local local-datadir2
rexray ebs-datadir
34. Docker Network - Types
Copyright 2012 Severalnines AB
● Single-host:
○ Host
○ None
○ Bridge
■ Default bridge (docker0)
■ User-defined bridge
● Multi-host:
○ Default overlay
○ User-defined overlay
● Extensible via Docker network plugins.
# List all networks
$ docker network ls
NAME DRIVER SCOPE
bridge bridge local
db_multi overlay swarm
db_single bridge local
docker_gwbridge bridge local
host host local
ingress overlay swarm
none null local
35. Docker Network - Host Network
Copyright 2012 Severalnines AB
# Run a container on host network
$ docker run -d
--name mysql-host
--net host
-e MYSQL_ROOT_PASSWORD=mypassword
mysql:5.7
Container 1
eth0
eth0
Container 2
eth0
Docker
Host
# Display active TCP connections
$ netstat -tulpn | grep mysql
tcp6 0 0 :::3306 :::* LISTEN 24601/mysqld
● Container’s network interfaces will be identical with
the machine host.
● Only one host network per machine host.
● Container linking, --link mysql-test:mysql is not
supported.
● Port mapping, --publish 3307:3306 is not
supported.
36. Docker Network - Default Bridge
Network
Copyright 2012 Severalnines AB
# Run a container on docker0 bridge network
$ docker run -d
--name mysql-bridge
-p 3308:3306
-e MYSQL_ROOT_PASSWORD=mypassword
mysql:5.7
Container 1
eth0
eth0
Container 2
eth0
Docker
Host
# Display active TCP connections
$ netstat -tulpn | grep 3308
tcp6 0 0 :::3308 :::* LISTEN 24601/docker-proxy
● Packet forwarding by iptables to the bridge network.
● --publish is supported. Run multiple containers with
same image through different ports.
● --link is supported. Link with other containers to
expose environment variables.
● docker-proxy redirects connection to the correct
container through NAT.
docker0
(virtual Ethernet bridge)
vethxxx vethyyy
37. Docker Network - User-Defined
Bridge Network
Copyright 2012 Severalnines AB
# Run a container on user bridge network
$ docker run -d
--name mysql1
--net db_single
-p 3308:3306
--ip 192.168.10.10
--hostname mysql1
-e MYSQL_ROOT_PASSWORD=mypassword
mysql:5.7
Container 1
eth0
eth0
Container 2
eth0
Docker
Host
# Create a new bridge network
$ docker network create subnet=192.168.10.0/24 db_single
Similar to the default docker0 bridge, plus:
● --hostname is supported for sticky hostname.
● --ip is supported for sticky IP address.
● --link is not supported. Use embedded DNS to
resolve container's name in the same network.
db_single
(virtual Ethernet bridge)
vethxxx vethyyy
DNS
38. Docker Network - Plugins
Copyright 2012 Severalnines AB
● Similar to volume, Docker network can be extended
through plugins:
○ Multi-host networking (must use outside of
Swarm)
○ Name resolver and service discovery.
○ Encryption.
● Popular network plugins:
○ Contiv
○ Calico
○ Weave
○ Flannel
Further Reading - Multi-host Networking with Calico:
https://severalnines.com/blog/mysql-docker-multi-host-networkin
g-mysql-containers-part-2-calico
39. Docker Network - Default Overlay
Network
Copyright 2012 Severalnines AB
# Run a service on default overlay network
$ docker service create
--name mysql-service
--replicas 1
-p 3308:3306
-e MYSQL_ROOT_PASSWORD=mypassword
-v nfs-datadir:/var/lib/mysql
mysql:5.7
Container 1
eth0
eth0 eth1
Docker
Host
# Initialize Docker Swarm
$ docker swarm init
● Docker Swarm must be enabled.
● Each task (container) has:
○ eth0 - Interface to external network via
docker_gwbridge.
○ eth1 - Interface to overlay network via VXLAN.
docker_gw
bridge
vethxxx vethyyy
br0
External
Container 2
eth0 eth1
Docker
docker_gw
bridge
vethxxx vethyyy
br0
eth0
Host
VXLAN
udp/4789
40. Docker Network - User-Defined
Overlay Network
Copyright 2012 Severalnines AB
# Run a service on default overlay network
$ docker service create
--name mysql-service
--replicas 1
--net db_multi
-p 3308:3306
-e MYSQL_ROOT_PASSWORD=mypassword
-v nfs-datadir:/var/lib/mysql
mysql:5.7
Container 1
eth0
eth0 eth1
Docker
Host
# Create an overlay network
$ docker network create -d overlay db_multi
Similar with the default overlay, plus:
● Embedded DNS resolver:
○ {service_name} → Service VIP
○ tasks.{service_name} → Container's IP
docker_gw
bridge
vethxxx vethyyy
br0
External
Container 2
eth0 eth1
Docker
docker_gw
bridge
vethxxx vethyyy
br0
eth0
Host
VXLAN
udp/4789
DNS
44. Docker Orchestration - Run with
Docker Compose
Copyright 2012 Severalnines AB
# Bring up the production MySQL container in background
$ docker-compose up -d
Creating network "compose_db-prod" with driver "bridge"
Creating compose_mysql-prod_1
Image: docker.io/mysql:5.7.18
de70fa77eb2b
f6016aab25f1
0639788facc8
35369f9634e1
937bbdd4305a
ad74af05f5a2
0639788facc8
35369f9634e1
937bbdd4305a
mysql-prod
416f2a92355f
/var/lib/mysql
mysql-datadir
/tmp
mysql-tmp
3307
# Stop the container
$ docker-compose stop
# Destroy everything
$ docker-compose down
# Start the container
$ docker-compose start
Scaling is supported via docker-compose scale, however
conflicting options must be omitted:
hostname, ports, ipv4_address, volume
45. Docker Orchestration - Docker Swarm
Copyright 2012 Severalnines AB
● Multi-host deployment, through overlay network.
● Concepts:
○ Node
■ Manager - Dispatches tasks
■ Worker - Executes tasks by manager
○ Service
■ Replicated - Number of replicas
■ Global - One task per available node
○ Task
■ Container
○ Mesh routing
■ All Swarm nodes route to the running tasks
■ Ingress load balancing (round-robin only)
○ Scheduler
■ Resources availability
■ Label and constraints
46. Docker Orchestration - Simple Auto
Failover using Swarm
Copyright 2012 Severalnines AB
# Run a replica of MySQL service
$ docker service create
--name mysql-service
--replicas 1
--net db_multi
-p 3307:3306
-e MYSQL_ROOT_PASSWORD=mypassword
--mount
source=ebs-datadir,destination=/var/lib/mysql,volume-driv
er=rexray
--mountsource=ebs-conf,destination=/etc/my.cnf.d,volume-d
river=rexray
mysql:5.7
mysql-
service
Docker
Host 1
ebs-datadir
mysql-
service
Docker
Host 2
3307
ebs-conf
49. Docker Orchestration - Best Practice for
MySQL
Copyright 2012 Severalnines AB
● Add label to node and use placement constraints:
○ Avoid overcommit resources.
○ Manageability and predictability.
● Use Service's name and virtual IP address to distinguish
container's role.
● Understand the scheduling strategy:
○ Spread
○ Binpack
○ Random
○ Custom
● Rolling update:
○ Only perform update one container at a time.
○ Add delay before move to the next container.
51. ClusterControl on Docker - Image
Copyright 2012 Severalnines AB
● Image is available at Docker Hub. Dockerfile at Github.
● Automation software for database clusters.
● Status: Non-production.
● The image consists of:
○ ClusterControl v1.4.2
○ Percona Server for MySQL
○ Apache + SSL
○ SSH key
● Key changes:
○ Some ClusterControl defaults are changed to
support Docker.
○ Automatic deployment (Galera only)
52. # Create a user-defined bridge for DB network
$ docker network create --subnet=192.168.10.0/24
db-cluster
# Run a ClusterControl container
$ docker run -d --name clustercontrol
--network db-cluster
--ip 192.168.10.10
-h clustercontrol
-p 5000:80
-p 5001:443
-v /storage/clustercontrol/cmon.d:/etc/cmon.d
-v /storage/clustercontrol/datadir:/var/lib/mysql
-v /storage/clustercontrol/.ssh:/root/.ssh
-v /storage/clustercontrol/backups:/root/backups
-e CMON_PASSWORD mysecr3t
-e MYSQL_ROOT_PASSWORD mys3cret
severalnines/clustercontrol
# Restart cmon service inside container
$ docker exec -it clustercontrol supervisorctl
restart cmon
ClusterControl on Docker - Run as
Container
Copyright 2012 Severalnines AB
● Recommended volumes for data persistence:
○ /etc/cmon.d
○ /var/lib/mysql
○ /root/.ssh
○ /root/backups
● ClusterControl UI is exposed at 80 and 443 by default.
● Service control via supervisord: sshd, mysqld, httpd,
cmon, cmon-ssh, cmon-events, cc-auto-deployment
● Run it as:
○ --net=host, if you want this container to
manage host or container outside of Docker
network.
○ --net={net_name}, if you want CC container to
manage containers in the same Docker network.
53. # Run a ClusterControl container
$ docker run -d --name=clustercontrol
-p 5000:80
-p 5001:443
-h clustercontrol
-v /storage/clustercontrol/.ssh:/root/.ssh
-v /storage/clustercontrol/datadir:/var/lib/mysql
-v /storage/clustercontrol/cmon.d:/etc/cmon.d
-v /storage/clustercontrol/backups:/backups
severalnines/clustercontrol
# Run a 3 node Galera cluster, with auto deployment
$ for i in {1..3}; do
docker run -d
--name galera${i}
-p 666{$i}:3306
--link clustercontrol:clustercontrol
-e CLUSTER_TYPE=galera
-e CLUSTER_NAME=mygalera
-e INITIAL_CLUSTER_SIZE=3
severalnines/centos-ssh
done
ClusterControl on Docker - Auto DB
Cluster Deployment
Copyright 2012 Severalnines AB
● Use "severalnines/centos-ssh" image - configures
passwordless SSH automatically from CC to DB
containers and register the container with CC.
● Only Galera is supported (more to come).
● Background script, cc-auto-deployment:
○ Monitors new containers registration.
○ Triggers deployment job if AUTO_DEPLOYMENT=1
(default).
○ Uses ClusterControl CLI, called 's9s' to interact
with cmon backend.
● Deployment flow:
○ You create the container.
○ cc-auto-deployment picks up the registered
containers and creates a deployment job.
○ ClusterControl deploys the cluster.
54. ClusterControl on Docker - Manual DB
Cluster Deployment
● Use "severalnines/centos-ssh" image with
AUTO_DEPLOYMENT=0.
● Allows user to have better control on the deployment
process initiates by ClusterControl.
● All supported database cluster can be deployed using
this method.
● Deployment flow:
a. You create the containers.
b. You create the database deployment job
through ClusterControl UI.
c. ClusterControl deploys the cluster.
Copyright 2012 Severalnines AB
Further Reading - Example at Github:
https://github.com/severalnines/docker/tree/master/examples/do
cker
55. ClusterControl on Docker - Add Existing
DB Containers
Copyright 2012 Severalnines AB
● Must be in the same Docker network with the DB
containers.
● SSH server and client must be installed and started on
the DB containers:
○ Setup passwordless SSH from ClusterControl
container to the DB containers.
○ It's going to improve though.
Further Reading - Import Existing DB Containers into
ClusterControl:
https://severalnines.com/blog/clustercontrol-docker
57. Copyright 2017 Severalnines AB
● Follow our MySQL on Docker blog series at
severalnines.com/blog
● Attend the 2nd MySQL on Docker webinar, MySQL
Container Management:
○ Coming Soon in November 2017
● Deploy DB containers using ClusterControl Docker
image.
What's Next