栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

K8S mysql8.x主从

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

K8S mysql8.x主从

helm repo add bitnami https://charts.bitnami.com/bitnami

helm install mysql bitnami/mysql 
--set auth.rootPassword=123qwe 
--set architecture=replication 
--set secondary.replicaCount=1 
--set secondary.persistence.storageClass=rook-ceph-block 
--set secondary.persistence.size=1G 
--set primary.persistence.storageClass=rook-ceph-block 
--set primary.persistence.size=1G

主库

mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000003 |      339 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

从库

mysql> show slave statusG
*************************** 1. row ***************************
               Slave_IO_State: Waiting for source to send event
                  Master_Host: mysql-primary
                  Master_User: replicator
                  Master_Port: 3306
                Connect_Retry: 10
              Master_Log_File: mysql-bin.000003
          Read_Master_Log_Pos: 339
               Relay_Log_File: mysql-relay-bin.000006
                Relay_Log_Pos: 555
        Relay_Master_Log_File: mysql-bin.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 

扩容从库

# kubectl  get pods | grep mysql-secondary
mysql-secondary-0                              1/1     Running   0              13h
mysql-secondary-1                              1/1     Running   0              4m15s
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| bbc                |
| information_schema |
| my_database        |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
6 rows in set (0.01 sec)

mysql> show slave statusG
*************************** 1. row ***************************
               Slave_IO_State: Waiting for source to send event
                  Master_Host: mysql-primary
                  Master_User: replicator
                  Master_Port: 3306
                Connect_Retry: 10
              Master_Log_File: mysql-bin.000003
          Read_Master_Log_Pos: 339
               Relay_Log_File: mysql-relay-bin.000006
                Relay_Log_Pos: 555
        Relay_Master_Log_File: mysql-bin.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 

一主两从

# kubectl  get pods | grep mysql
mysql-primary-0                                1/1     Running   0              13h
mysql-secondary-0                              1/1     Running   0              13h
mysql-secondary-1                              1/1     Running   0              6m42s

更多参数

https://github.com/bitnami/charts/tree/master/bitnami/mysql/#parameters
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/881556.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号