Introduction
This document describes how to deploy the MySQL group replication (MGR) solution using Kubernetes (abbreviated as K8s). This solution uses K8s as the container management platform. K8s uses pods as scheduling units. A pod can contain multiple containers. Containers in the same pod share the same IP address and port. They are always located in the same location and scheduled together. In this document, one pod contains only one container. Kube-OVN is used as the network plugin of K8s. Kube-OVN is used to configure a fixed IP address and MAC address for each pod. After the pod is redeployed, the IP address and MAC address in the pod remain unchanged. The external network can access the MySQL pod through the service. You can also configure a static route to expose the IP address of the MySQL pod. In this document, MGR is deployed in primary/secondary mode, with one primary node and two secondary nodes configured. To ensure performance, the local storage of the compute node (worker) is used to store the MySQL data and configuration files. In this case, the MySQL pod needs to be bound to the compute node. This prevents the MySQL pod from connecting to other compute nodes owing to K8s scheduling and further avoids data loss. Because of the restriction imposed by K8s, the MySQL pod can run only on a single
In this document, the physical machine with the IP address 192.168.200.10 is used as the primary node of K8s, and the physical machines with the IP addresses 192.168.200.218, 192.168.200.220, and 192.168.200.222 are used as the compute nodes of the K8s. mysql-1, mysql-2, and mysql-3 are deployed on the three compute nodes, respectively. mysql-1 serves as the primary database, and mysql-2 and mysql-3 serve as the secondary databases, which together form an MGR cluster with one primary database and two secondary databases.
|
Term |
Description |
|---|---|
|
Docker |
An open-source engine that implements container virtualization. |
|
Image |
A read-only template, which instructs you to create a container. Images are built by layers. The file that defines these layers is called Dockerfile. |
|
Container |
An executable instance in an image. |
|
K8s (Kubernetes) |
An open-source system used to automatically deploy, scale, and manage containerized applications. |
|
Primary node |
A central node that provides control and scheduling functions in K8s. |
|
Compute node (worker) |
A node that is responsible for service load in K8s. Workload can be allocated to each compute node by the primary node. |
|
Kube-OVN |
An open-source K8s network plugin based on OpenOVS. |
|
Pod |
The basic scheduling unit of K8s is called pod, which carries containers that run service programs. |
|
service |
A resource provided by K8s for external access to pods. |
|
MySQL Pod |
A pod where the MySQL service program is deployed. |
|
MGR (MySQL Group Replication) |
MySQL 5.7.17 introduces an HA and high-scalability database solution. |
