首页文章正文

k8s mysql集群,k8s生产环境部署mysql

k8s redis集群 2023-06-07 15:32 402 墨鱼
k8s redis集群

k8s mysql集群,k8s生产环境部署mysql

k8s mysql集群,k8s生产环境部署mysql

@[TOC]k8sinstallMysqlclusterproblemssummary1.Error0/3nodesareavailable:3podhasunboundimmediatePersistentVolumeClaims.kubectlgetpod-ANAMESPACENAM5.VerifyMySQLmaster-slavereplication11.21:kubectlexec-itmysql-0--bash##Entermysqk-0podmysql-hmysql-0.mysql##进入数据库CREATEDATABASE测试;##创建数据库表

[根@mastermysql]#catcm.yamlapiVersion:v1kind:ConfigMapmetadata:name:mysqllabels:app:mysqldata:master.cnf:|[mysqld]log-bin#mastermysqlactivatebinarylogslave.cnf:| [mysqld]supDeployMySQLclusterenvironmentbasedonK8S'sStatefulSet:nameversionotherK8S1.20.4mysql5.7onemasterandtwoslavesnfsserver172.16.201.209#UseNFSstoragevolumestopersistentlystoremysql数据目录要求:

\ _ / MySQL部署包括ConfigMap、Service和StatefulSet[root@master~]#moremysql-configmap.yamlapiVersion:v1kind:ConfigMapmetadata:name:mysqllabels:MountingMySQLdatavolumesinak8sclusterrequiresinstallinganNFS。 在主节点上安装NFyuminstall-ynfs-utilsrpcbind在主节点上创建目录mkdir-p/nfschmod777/nfsChangethebelonginggroupanduserchown-Rnf

地址是https://hub.docker/(这是因为我们在使用k8sformmysqlcluster部署的时候,k8s会默认去dockerhub下载镜像。一般在生产环境下,服务器是不联网的,所以通常会build自己的dockerhub服务11.21/22/23(所有K8节点):1.安装NFS1yum-yinstallnfs-utils2.测试TrywhetheryoucandetecttheNFSshareddirectory1showmount-e192.168.11.24##Seeifyoucansee/nfs*2.Create

+△+ catmysql.pv.yamlapiVersion:v1kind:PersistentVolumemetadata:name:pv-nfs-mysql01#createdpvnamecancreatemultiple.namespace:mt-math#belongingnamespacesp"apiVersion":"storage.k8s.io/v1","kind":"StorageClass"," metadata":{"annotations":{},"name":"nfs"},"provisioner":"nfs","re​​claimPolicy":"Delete"}

后台-插件-广告管理-内容页尾部广告(手机)

标签: k8s生产环境部署mysql

发表评论

评论列表

黑豹加速器 Copyright @ 2011-2022 All Rights Reserved. 版权所有 备案号:京ICP1234567-2号