#HSLIDE
(Thanks to Ansible)
#VSLIDE?image=assets/images/cali.jpg
#VSLIDE
- The only company that delivers enterprise-class support, consulting, managed services and software
- MySQL®
- MariaDB®
- MongoDB®
- And other open source databases across on-premise and cloud-based platforms.
- 3000 clients worldwide / Employs a global network of experts with a staff of over 140 people
#HSLIDE
#VSLIDE
Percona Server for MySQL® is a free, fully compatible, enhanced, open source drop-in replacement for MySQL
![Percona Server](assets/images/percona-server-web.png)
#VSLIDE
- Is an open-source relational database management system (RDBMS)
- With a lot of features
- Being the replication the feature that we need to put focus today.
![MySQL](assets/images/mysql.png)
#VSLIDE
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: mysql1
![Replication](assets/images/replication.png)
#HSLIDE
#VSLIDE
For infrastructure :) (For databases)
#VSLIDE
- Not chroot (but isolates)
- Not LXC (and thus not Jails)
- For what is worth: is an isolated process.
- With an ip.
- And resources that can be limited independent (https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt)
- ...at a very high level.
#VSLIDE
- It's a VM running the Linux Alpine distro (https://alpinelinux.org)
- So technically, the containers still runs on a Linux OS
- Drawbacks like: The host cannot see the containers via network (though there is https://github.com/moby/vpnkit)
#VSLIDE
![Docker](assets/images/docker.png) ![Vagrant](assets/images/vagrant.png) ![AWS EC2](assets/images/ec2.jpg)
#VSLIDE
- When Docker?
- When a VM with Vagrant (+ VirtualBox)?
- When EC2?
- ...and when on the customer's infrastructure???
#VSLIDE
- A bunch of layers.
- As described in a "Dockerfile"
- We need a Docker image with MySQL
#VSLIDE
...or let's use an existent one! :)
#VSLIDE
- Images made by Docker (the company)
- Images made by users. Percona have official images
- No need to build anything
- Ready to pull
#VSLIDE?image=assets/images/percona-docker-hub.png
https://hub.docker.com/r/percona/percona-server/
#VSLIDE
FROM debian:jessie
MAINTAINER Percona Development <[email protected]>
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https ca-certificates \
pwgen \
&& rm -rf /var/lib/apt/lists/*
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 8507EFA5
RUN echo 'deb https://repo.percona.com/apt jessie testing' > /etc/apt/sources.list.d/percona.list
# the numeric UID is needed for OpenShift
RUN useradd -u 1001 -r -g 0 -s /sbin/nologin \
-c "Default Application User" mysql
ENV PERCONA_MAJOR 5.7
ENV PERCONA_VERSION 5.7.18-16-4.jessie
https://github.com/percona/percona-docker/blob/master/percona-server/Dockerfile
#VSLIDE
docker run --name container-name -e MYSQL_ROOT_PASSWORD=secret -d percona/percona-server:tag
#VSLIDE
- An image (Done!)
- A network (not done)
- A shared volume (in this case, just a shared file)
- An exposed port (MySQL default port: 3306)
#VSLIDE
- Make sure all the containers share the same subnet
- Take advantage of the built-in DNS
- Cleaner
docker network create <name>
#VSLIDE
- Shared directories-like
- We need a custom MySQL Configuration file (To set the binary log options for the replica)
#VSLIDE
- Port forwarding
- So we can connect to MySQL
#HSLIDE
#VSLIDE
#VSLIDE
- An IT automation engine
- Written in Python
- Idempotent
- No agents involved
- Simple language: YAML
Ansible works by connecting to your nodes
and pushing out small programs,
called "Ansible modules" to them.
These programs are written to be resource models
of the desired state of the system.
Ansible then executes these modules (over SSH by default),
and removes them when finished.
#VSLIDE
- An inventory (list of hosts)
- A playbook (a bunch of task to execute)
- A task (a module with parameters)
- Modules (small python scripts that does the job)
#VSLIDE
- SSH
- Python
- Git (this is optional)
#VSLIDE
- docker_container
- docker_network
- docker_image
- templates
- command
- ini_file
#VSLIDE
#HSLIDE
#VSLIDE
https://github.com/nethalo/ansible-mysql-docker
#HSLIDE
#VSLIDE