1.安装operator:MysqlCluster
2.使用operator安装mysql8.0集群
CREATE USER 'root' IDENTIFIED BY '134er6'; ALTER USER 'root'@'%' IDENTIFIED BY 'Qwer#@!'; apiVersion: mysql.radondb.com/v1alpha1 kind: MysqlCluster metadata: name: mysql-cluster spec: replicas: 3 mysqlVersion: "8.0" # the backupSecretName specify the secret file name which store S3 information, # if you want S3 backup or restore, please create backup_secret.yaml, uncomment below and fill secret name: # backupSecretName: # if you want create mysqlcluster from S3, uncomment and fill the directory in S3 bucket below: # restoreFrom: mysqlOpts: image: harbor.goldwind.com/library/percona/percona-server:8.0.25 user: project_user password: wHrr*48+M database: project_database ## tokudb is not supported in mysql8. # initTokuDB: false # A simple map between string and string. # Such as: # mysqlConf: # expire_logs_days: "7" mysqlConf: {} resources: requests: cpu: 256m memory: 256Mi limits: cpu: 1000m memory: 1Gi xenonOpts: image: harbor.goldwind.com/library/radondb/xenon:v2.3.0 admitDefeatHearbeatCount: 5 electionTimeout: 10000 resources: requests: cpu: 50m memory: 128Mi limits: cpu: 100m memory: 256Mi metricsOpts: enabled: false image: harbor.goldwind.com/library/prom/mysqld-exporter:v0.12.1 resources: requests: cpu: 10m memory: 32Mi limits: cpu: 100m memory: 128Mi podPolicy: imagePullPolicy: IfNotPresent sidecarImage: harbor.goldwind.com/library/radondb/mysql80-sidecar:v2.3.0 busyboxImage: harbor.goldwind.com/library/busybox:1.32 slowLogTail: false auditLogTail: false labels: {} annotations: {} affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app.kubernetes.io/name operator: In values: - mysql topologyKey: "kubernetes.io/hostname" priorityClassName: "" tolerations: [] schedulerName: "" # extraResources defines quotas for containers other than mysql or xenon. extraResources: requests: cpu: 10m memory: 32Mi limits: cpu: 100m memory: 125Mi persistence: enabled: true accessModes: - ReadWriteOnce storageClass: "managed-nfs-storage" size: 20Gi
3.创建root密码
此operator只支持创建项目账户及数据库,若要使用管理员权限,可以在rancher中service的leader svc中找到mster pod然后执行root改密码的操作
ALTER USER 'root'@'%' IDENTIFIED BY 'Qwer#@!';
4.创建主从节点:leader和follower的nodeport svc
标签:harbor,root,library,集群,memory,helm,mysql8.0,com,cpu From: https://www.cnblogs.com/xiaoxiaomuyuyu/p/17570864.html