Deploying MySQL and MongoDB in Kubernetes

Kubernetes作为其最流行的发行版Openshift,作为一个容器编排平台受到了广泛关注。但是,数据库仍然是一个外部实体,主要是因为它们具有状态性。
在本演示中,我将讨论如何在kubernetes/openshift上部署开源数据库(mysql/percona xtradb cluster和mongodb)。对于PerconaXtradb集群(PXC),我们将使用MySQL代理来实现读/写拆分。
如果您从未使用过kubernetes和openshift,我将快速介绍这些技术。还有一个演示,我将使用proxysql和openshift-origin中的mongodb replicaset建立一个pxc集群,并尝试将其破坏。
本次网络研讨会结束后,您将更好地了解:
如何在您的环境中利用kubernetes/openshift 如何使用statefulset在kubernetes/openshift中部署开源数据库。
*如何操作Kubernetes中的数据库

展开查看详情

1.Deploying MySQL and MongoDB in Kubernetes Alexander Rubin Percona

2.About me ● Working with MySQL for 10-15 years ○ Started at MySQL AB, Sun Microsystems, Oracle (MySQL Consulting) ○ Joined Percona in 2013 2

3.What is Kubernetes? Container orchestration system /* Operating system */ * Kubernetes is an open source system for managing containerized applications across multiple hosts 3

4.Container orchestration 4

5.Container Orchestration in Barcelona 5

6.Why ? Deployment, Deployment, Deployment! ○ Challenge: how to deploy massively scaled application ○ Or databases: how do you deploy 100 nodes clustering system 6

7.Kubernetes Implementations ● ● ● ● ● ● ● 7

8.Let’s look under the hood 8

9.

10.

11.● ● ● ● ● ○

12.Databases in Containers: Challenges 1. Preserving state 2. Setup as cluster/replication 12

13.● ○ ○

14.

15.Why for databases? 15

16.MySQL In Kubernetes ● A single instance is easy ○ https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-appli cation/ 16

17.A complex setup is … more complex ● High Availability ● Persistent Storage ● Backup and recovery ● Traffic routing ● Monitoring 17

18.18

19.Replication

20.Replication Options ● Traditional MySQL replication ● Group Replication ● Percona XtraDB Cluster 20

21.Traditional Replication challenges ● No automatic failover ○ New master detection can be quite complicated ● No automatic slave setup 21

22.Group Replication ● Not mature enough ● Still no automatic slave setup 22

23.What is Percona XtraDB Cluster (PXC)? 23

24.Why PXC? Auto provisioning... 24

25.PXC: Data transfer 25

26.Storage

27.Storage options ● Local storage ○ Can be fast (SSD, NVMe options) ○ Still limited management capabilities in Kubernetes ● Network storage ○ Management and Flexibility if supported by your setup ■ Supported by major cloud providers ○ On-premise setup may require Ceph or SAN ○ The dynamic provision of persistent volumes is required 27

28.Traffic routing

29.Traffic routing ● ProxySQL ○ High-performance MySQL proxy ○ Query Routing ○ Supports Failover 29