四款官方MySQL Operator

Posted _雪辉_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了四款官方MySQL Operator相关的知识,希望对你有一定的参考价值。

文章目录


  Operator 是构建在 Kubernetes 之上的控制器,可以自动化和简化特定的复杂操作。在 Kubernetes 中运行数据库变得与 Operator 无缝连接,因为它们弥合了有状态数据库和在 Kubernetes 中运行的无状态应用程序之间的差距。它们使用声明性配置格式更容易打包、部署和管理生产就绪的 mysql 集群。它们还有助于备份、扩展和恢复,并且可以在现有 Kubernetes 集群内的任何位置运行。

1、Oracle MySQL Operator 
 https://github.com/mysql/mysql-operator
 
2、Percona MySQL Operator
 https://github.com/percona/percona-xtradb-cluster-operator
 
3、Bitpoke MySQL Operator
https://github.com/bitpoke/mysql-operator
 
4、GrdsCloud MySQL Operator 
https://operatorhub.io/operator/mysql

一、Oracle MySQL Operator

  Oracle MySQL Operator 是一个稳定可靠的数据库管理系统,通常被视为流行 Web 主机(包括 WordPress)的默认安装。

Oracle MySQL Operator 的主要特性包括:

  • 自我修复解决方案:Oracle MySQL Operator 可以创建和扩展在 Kubernetes 中运行的 MySQL InnoDB 集群。它利用 Group Replication 插件创建可以在单主模式下运行的容错组,在这种模式下,在任何给定时间,只有一个服务器会批准升级。这些组还可以在多主模式下运行,所有服务器将同时接受升级。这个多主复制插件提供了强大的随处更新优势以及内置的冲突识别和解决、组成员身份和自动分布式恢复能力。

  • 备份和恢复:按需创建备份或使用调度程序功能在预设时间将数据库自动备份到对象存储。用户还可以从现有备份中恢复数据库。

  • 架构:利用 InnoDB 和 Group Replication 在 Kubernetes 上创建和扩展 MySQL 集群。如果集群实例死亡,MySQL Operator 会自动将它们恢复到集群中。Kubernetes Persistent Volume Claims 允许您将数据存储在网络链接存储或本地磁盘上。

  • 性能:它使用自定义资源定义来扩展 Kubernetes API。MySQL Operator 用户可以使用这些第三方资源对象进行交互。

  • 易用性:使用此 Operator 创建 MySQL 集群轻而易举。只需定义 YAML 文件并使用 kubectl 直接提交给 Kubernetes。Operator 将监视 MySQL 集群资源并采取措施创建 MySQL 集群。

# Using kubectl
For creating a MySQL InnoDB Cluster, first create a secret with credentials for a MySQL root user used to perform administrative tasks in the cluster. For example:

$> kubectl create secret generic mypwds \\
        --from-literal=rootUser=root \\
        --from-literal=rootHost=% \\
        --from-literal=rootPassword="sakila"
Define your MySQL InnoDB Cluster, which references the secret. For example:

apiVersion: mysql.oracle.com/v2
kind: InnoDBCluster
metadata:
  name: mycluster
spec:
  secretName: mypwds
  tlsUseSelfSigned: true
  instances: 3
  router:
    instances: 1
Assuming it's saved as mycluster.yaml, deploy it:

$> kubectl apply -f mycluster.yaml
This sample creates an InnoDB Cluster with three MySQL Server instances and one MySQL Router instance. The process can be observed using:

$> kubectl get innodbcluster --watch

NAME          STATUS    ONLINE   INSTANCES   ROUTERS   AGE
mycluster     PENDING   0        3           1         2m6s
...
mycluster     ONLINE    3        3           1         10s


# Using Helm
Create MySQL InnoDB Cluster installations using defaults or with customization. Here's an example using all defaults for a cluster named mycluster:

$> helm install mycluster mysql-operator/mysql-innodbcluster
Or customize, this example sets options from the command line:

$> helm install mycluster mysql-operator/mysql-innodbcluster \\
        --namespace mynamespace \\
        --create-namespace \\
        --set credentials.root.user='root' \\
        --set credentials.root.password='supersecret' \\
        --set credentials.root.host='%' \\
        --set serverInstances=3 \\
        --set routerInstances=1

二、Percona MySQL Operator

  Percona MySQL 是一个综合性的操作符,它为高要求、资源密集型的应用程序提供支持。它提供各种性能优化工具以及 XtraDB 作为其存储引擎。XtraBackup 和 XtraDB Cluster 提供了许多与该引擎兼容的工具,使 DBA 的日常管理任务更加轻松。

Percona MySQL Operator 的主要特点是:

  • 部署和扩展:您可以创建跨多个可用区的 Percona XtraDB 集群环境,而不会出现任何故障点。为了可扩展性,您可以更改大小参数以添加或删除 XtraDB 集群成员。

  • 安全性:Percona 提供强大的安全功能,例如自动密码轮换、传输中的数据加密以及对私有注册表访问的支持。

  • 架构:Percona XtraDB Cluster 通过将 Percona Server for MySQL 与 XtraDB 引擎和 Percona XtraBackup 与 Galera 库集成来提供同步的多主复制。

  这是 Percona 架构的快速概述。使用节点关联,Operator 通过在单独的节点上运行 Percona XtraDB Cluster 实例来提供高可用性。如果一个节点发生故障,一个 pod 会自动重新加入另一个节点。同样,它使用 PVC (PersistentVolumeChain) 自动为 pod 提供存储。

#Helm
Install the Operator:
helm install my-op percona/pxc-operator

Install Percona XtraDB Cluster:
helm install my-db percona/pxc-db

# kubectl
Deploy the Operator from deploy/bundle.yaml:
kubectl apply -f https://raw.githubusercontent.com/percona/percona-xtradb-cluster-operator/main/deploy/bundle.yaml

Deploy the database cluster itself from deploy/cr.yaml:
kubectl apply -f https://raw.githubusercontent.com/percona/percona-xtradb-cluster-operator/main/deploy/cr.yaml

三、Bitpoke MySQL Operator

  Bitpoke MySQL Operator 管理用于在 Kubernetes 中部署和管理高可用性 MySQL 集群的所有基本资源。此外,它还有助于简化数据库操作,例如扩展、备份和故障转移。为了适合您的使用案例,您可以为多个站点创建一个集群或为每个站点创建一个集群。

  Bitpoke MySQL Operator 对 DevOps 友好,这意味着它简化了监控、可扩展性、可用性和备份流程。它支持时间点恢复和备份(按需和计划),还支持集群内和集群间的克隆。

Bitpoke MySQL Operator 的主要优势包括:

  • 架构:Bitpoke MySQL Operator 使用 Percona Server 和 Openark 的 Orchestrator 在 Kubernetes 上提供异步 MySQL 复制。

  • 易用性:Bitpoke MySQL Operator 入门简单快捷。用户只需访问安装了 Helm 和 kubectl 的 Kubernetes 集群。

  • 借助此README 图表,您可以将控制器与协调器 集群一起部署。 Bitpoke MySQL Operator 的文档已经足够了。在安全性方面,不幸的是,Bitpoke 缺乏可靠的安全功能:它只提供 SSL 支持。

# Controller deploy
helm repo add bitpoke https://helm-charts.bitpoke.io
helm install mysql-operator bitpoke/mysql-operator
# Deploying a cluster
kubectl apply -f https://raw.githubusercontent.com/bitpoke/mysql-operator/master/examples/example-cluster-secret.yaml
kubectl apply -f https://raw.githubusercontent.com/bitpoke/mysql-operator/master/examples/example-cluster.yaml

四、GrdsCloud MySQL Operator

  GrdsCloud MySQL Operator 可帮助您在 Kubernetes 等基于容器的环境中运行无状态 MySQL。您无需更改 MySQL 数据库的权限,因此管理和扩展可用于生产的 MySQL 集群变得更加容易。

GrdsCloud MySQL Operator 的主要特点是:

  • 易于构建:安装 GrdsCloud MySQL Operator 后,您可以快速构建和管理在 Kubernetes 中运行的容器化 MySQL 集群。这可以在基本的声明性配置的帮助下完成。用户可以轻松定义 cpu/io/memory 格式的参数。

  • 灾难恢复:灾难恢复、备份任务计划、一键式介质恢复。

  • 高可用性:它运行全自动数据库检查以识别故障。数据库中发生的更改会实时记录在二进制日志中。MySQL Operator 将处理这些更新,并在数据库出现故障时自动重新执行或修复二进制日志。根据情况,它会分配一个新的主实例。这将帮助用户获得高可用的 MySQL 集群。

  • SlowSQL Analyst:自动收集和分析应用程序SQL,提供优化建议。

# Deploy the MySQL operator from Kubernetes Manifests
Create a controlNamespace called "grds".
  kubectl create ns grds
Create a ServiceAccount and install cluster roles.
  kubectl -n grds create -f https://raw.githubusercontent.com/GrdsCloud/mysql-operator-docs/master/manifests/rbac.yaml
Apply the ClusterResources.
  kubectl -n grds create -f https://raw.githubusercontent.com/GrdsCloud/mysql-operator-docs/master/manifests/mysql.grds.cloud_mysqlclusters.yaml
Deploy the MySQL operator.
 kubectl -n grds create -f https://raw.githubusercontent.com/GrdsCloud/mysql-operator-docs/master/manifests/config.yaml
 kubectl -n grds create -f https://raw.githubusercontent.com/GrdsCloud/mysql-operator-docs/master/manifests/deployment.yaml

# Deploy MySQL operator with Helm
Add operator chart repository.
Helm v3
  helm repo add grdscloud-stable https://grdscloud.github.io/charts/
  helm repo update
Install the MySQL Operator
  helm upgrade --install --wait --create-namespace --namespace grds mysql-operator grdscloud-stable/mysql-operator

以上是关于四款官方MySQL Operator的主要内容,如果未能解决你的问题,请参考以下文章

四款官方MySQL Operator

四款官方MySQL Operator

云原生 | 混沌工程工具 ChaosBlade Operator 入门篇

程序员专属红包封面来了,一共四款

云原生 | 混沌工程工具 ChaosBlade Operator 入门篇(文末赠书)

steam国产新游戏推荐:四款最热新品加一款恐怖游戏