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 one or more containers. Containers in the same pod share the IP address and port, and are always located in the same place and scheduled together. In this document, each pod contains only one container.
Kube-OVN is used as the network plugin of K8s. It ensures that each pod is configured with a fixed IP address and MAC address. The IP address and MAC address of a pod remain unchanged even if the pod is redeployed. An external network can access the MySQL pod through the service. You can also configure a static route to directly access the IP address of the MySQL pod.
In this document, MySQL MGR is deployed in primary/secondary mode, with one primary node and two secondary nodes configured. To optimize performance, the local storage of the compute node is used to store 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 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. |
