• 在Kubernetes上安装MySQLPXC集群


    官方部署文档地址:https://www.percona.com/doc/kubernetes-operator-for-pxc/kubernetes.html

    一、部署方式

    示例在k8s集群(至少3个节点)中部署Percona XtraDB Cluster集群

    • clone项目
    git clone  https://gitee.com/Aaron-23/percona-xtradb-cluster-operator.git
    cd percona-xtradb-cluster-operator
    
    • 准备存储

    当前环境具有三个k8s node节点,每个node节点/var/lib/data目录有100GB存储空间

    所有存储均使用本地存储

    创建local-storageclass

    cd storage
    kubectl create -f local-sc.yaml
    

    创建pv

    修改values值为各pxc节点ip,spec.local.path路径根据实际情况自定义,

    kubectl create -f pv-data-172.yaml
    kubectl create -f pv-data-173.yaml
    kubectl create -f pv-data-174.yaml
    
    • 创建crd资源
     kubectl apply -f deploy/crd.yaml
    
    • 创建ns
     kubectl create namespace pxc
     kubectl config set-context $(kubectl config current-context) --namespace=pxc
    
    • 赋予rbac权限
    kubectl apply -f deploy/rbac.yaml
    
    • 在Kubernetes中启动operator
    kubectl apply -f deploy/operator.yaml
    
    • 使用secrets.管理Percona XtraDB集群相关秘钥

    需要设置数据库密码的修改secrets中密码即可

     kubectl create -f deploy/secrets.yaml
    
    • 创建Percona XtraDB Cluster
    kubectl apply -f deploy/cr.yaml
    

    创建过程将花费一些时间。当po和副本数都达到“Running”状态时,该过程结束:

    $ kubectl get pods
    NAME                                              READY   STATUS    RESTARTS   AGE
    cluster1-haproxy-0                                1/1     Running   0          5m
    cluster1-haproxy-1                                1/1     Running   0          5m
    cluster1-haproxy-2                                1/1     Running   0          5m
    cluster1-pxc-0                                    1/1     Running   0          5m
    cluster1-pxc-1                                    1/1     Running   0          4m
    cluster1-pxc-2                                    1/1     Running   0          2m
    percona-xtradb-cluster-operator-dc67778fd-qtspz   1/1     Running   0          6m
    
    • 检查与新创建集群的连接
     $ kubectl run -i --rm --tty percona-client --image=percona:8.0 --restart=Never -- bash -il
    percona-client:/$ mysql -h cluster1-haproxy -uroot -proot_password
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1976
    Server version: 8.0.19-10 Percona XtraDB Cluster (GPL), Release rel10, Revision 727f180, WSREP version 26.4.3
    
    Copyright (c) 2009-2020 Percona LLC and/or its affiliates
    Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
  • 相关阅读:
    RHEL6 建立DVD repo
    stl之std::remove_copy
    分鱼问题
    Nutch的日志系统
    log4j配置文件及nutch中的日志配置
    slf4j教程
    Java中的日期操作
    Avro基础
    【JAVA编码专题】总结
    【JAVA编码专题】深入分析 Java 中的中文编码问题
  • 原文地址:https://www.cnblogs.com/wiseo/p/15572933.html
Copyright © 2020-2023  润新知