Helm部署mysql8主从

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: Helm部署mysql8主从

helm是一款管理kubernetes yaml文件的强大工具,能实现整个项目所需yaml一次性编译,包括service account、rbac、configmap、storageClass、controller manager等等资源。


背景:

mysql作为业务常用的后端库,广泛用于数据存储和分析,但作为有状态服务,部署起来挑战不小,各种资源都需要apply yaml文件,容易出现报错失败且不好排查,helm就可以很好的解决,并且很高效。


一、准备工作

1、资源清单

helm 采用开源bitnami库的mysql进行操作


primary为主库、secondary为从库


二、部署helm

安装地址 PATH

下载包:helm-v3.11.1-linux-amd64.tar.gz

解压:

[root@localhost ~]# tar -xf helm-v3.11.1-linux-amd64.tar.gz 
[root@localhost ~]# cd linux-amd64/ 
[root@localhost linux-amd64]# ll
总用量 45788
-rwxr-xr-x 1 1001 1002 46870528 2月   9 01:29 helm
-rw-r--r-- 1 1001 1002    11373 2月   9 01:39 LICENSE
-rw-r--r-- 1 1001 1002     3367 2月   9 01:39 README.md
[root@localhost linux-amd64]# cp helm /usr/local/bin/
[root@localhost linux-amd64]# helm version
version.BuildInfo{Version:"v3.11.1", GitCommit:"293b50c65d4d56187cd4e2f390f0ada46b4c4737", GitTreeState:"clean", GoVersion:"go1.18.10"}


1、生成locat-path

bitnami本身不带创建storageclass,但有状态服务需要可持续化存储,所以本地需要自建一个storageclass供mysql生成pv和pvc使用。

[root@localhost ~]#  mkdir mysql
[root@localhost mysql]# pwd
/root/mysql
[root@localhost mysql]# cat > local-path-storage.yaml << EOF
apiVersion: v1
kind: Namespace
metadata:
  name: local-path-storage
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: local-path-provisioner-service-account
  namespace: local-path-storage
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: local-path-provisioner-role
rules:
  - apiGroups: [ "" ]
    resources: [ "nodes", "persistentvolumeclaims", "configmaps" ]
    verbs: [ "get", "list", "watch" ]
  - apiGroups: [ "" ]
    resources: [ "endpoints", "persistentvolumes", "pods" ]
    verbs: [ "*" ]
  - apiGroups: [ "" ]
    resources: [ "events" ]
    verbs: [ "create", "patch" ]
  - apiGroups: [ "storage.k8s.io" ]
    resources: [ "storageclasses" ]
    verbs: [ "get", "list", "watch" ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: local-path-provisioner-bind
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: local-path-provisioner-role
subjects:
  - kind: ServiceAccount
    name: local-path-provisioner-service-account
    namespace: local-path-storage
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: local-path-provisioner
  namespace: local-path-storage
spec:
  replicas: 1
  selector:
    matchLabels:
      app: local-path-provisioner
  template:
    metadata:
      labels:
        app: local-path-provisioner
    spec:
      serviceAccountName: local-path-provisioner-service-account
      containers:
        - name: local-path-provisioner
          image: rancher/local-path-provisioner:v0.0.22
          imagePullPolicy: IfNotPresent
          command:
            - local-path-provisioner
            - --debug
            - start
            - --config
            - /etc/config/config.json
          volumeMounts:
            - name: config-volume
              mountPath: /etc/config/
          env:
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
      volumes:
        - name: config-volume
          configMap:
            name: local-path-config
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-path
provisioner: rancher.io/local-path
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: local-path-config
  namespace: local-path-storage
data:
  config.json: |-
    {
            "nodePathMap":[
            {
                    "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES",
                    "paths":["/opt/local-path-provisioner"]
            }
            ]
    }
  setup: |-
    #!/bin/sh
    set -eu
    mkdir -m 0777 -p "$VOL_DIR"
  teardown: |-
    #!/bin/sh
    set -eu
    rm -rf "$VOL_DIR"
  helperPod.yaml: |-
    apiVersion: v1
    kind: Pod
    metadata:
      name: helper-pod
    spec:
      containers:
      - name: helper-pod
        image: busybox
        imagePullPolicy: IfNotPresent
EOF
#若报错:local-path-storage not found
[root@localhost mysql]# kubectl create ns local-path-storage
[root@localhost mysql]# kubectl apply -f local-path-storage.yaml
#设置为默认存储类
[root@localhost mysql]# kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

2、部署MySQL主从

helm是依靠模板内yaml文件获取values.yaml中的值实现freestyle风格部署。


如下是简单部署:

[root@localhost mysql]# cat > values.yaml << EOF
global:
  storageClass: "local-path"
auth:
  rootPassword: test123456
architecture: replication
metrics:
  enabled: true
primary:
  service:
    type: NodePort
    nodePorts:
      mysql: "30336"
EOF


storageClass:使用NFS存储

auth.rootPassword:nysql 的密码

architecture: 架构,这里是集群部署,默认是主从


values与模板内定义对应关系,有的涉及到if/else end的语法可以自己去看看资料。

spec:
  type: {{ .Values.primary.service.type }}
解释:
.为顶域
primary.service.type取的值如下
primary:
  service:
    type: NodePort


运行chart为release,运行后副本默认为1,可以在values.yaml文件内定义,如下:

replicas: {{ .Values.secondary.replicaCount }}
secondary:
  replicaCount: 2
[root@localhost mysql]# kubectl create ns component
[root@localhost mysql]# helm install mysql bitnami/mysql -f values.yaml -n component
[root@localhost mysql]# helm list -A
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mysql   component       1               2023-03-24 10:41:28.897163202 +0800 CST deployed        mysql-9.7.0     8.0.32
[root@localhost mysql]# helm status mysql -n component
NAME: mysql
LAST DEPLOYED: Fri Mar 24 10:41:28 2023
NAMESPACE: component
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: mysql
CHART VERSION: 9.7.0
APP VERSION: 8.0.32
** Please be patient while the chart is being deployed **
Tip:
  Watch the deployment status using the command: kubectl get pods -w --namespace component
Services:
  echo Primary: mysql-primary.component.svc.cluster.local:3306
  echo Secondary: mysql-secondary.component.svc.cluster.local:3306
Execute the following to get the administrator credentials:
  echo Username: root
  MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace component mysql -o jsonpath="{.data.mysql-root-password}" | base64 -d)
To connect to your database:
  1. Run a pod that you can use as a client:
      kubectl run mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.32-debian-11-r14 --namespace component --env MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD --command -- bash
  2. To connect to primary service (read/write):
      mysql -h mysql-primary.component.svc.cluster.local -uroot -p"$MYSQL_ROOT_PASSWORD"
  3. To connect to secondary service (read-only):
      mysql -h mysql-secondary.component.svc.cluster.local -uroot -p"$MYSQL_ROOT_PASSWORD"
To access the MySQL Prometheus metrics from outside the cluster execute the following commands:
    kubectl port-forward --namespace component svc/mysql-metrics 9104:9104 &
    curl http://127.0.0.1:9104/metrics
#master
[root@localhost mysql]# kubectl get pods -A
NAMESPACE            NAME                                      READY   STATUS    RESTARTS   AGE
component            mysql-primary-0                           2/2     Running   0          5h32m
component            mysql-secondary-0                         2/2     Running   0          5h32m
kube-system          coredns-6c5f44f974-bmnk8                  1/1     Running   2          27d
kube-system          coredns-6c5f44f974-cn4mb                  1/1     Running   2          27d
kube-system          kube-flannel-ds-7q4ws                     1/1     Running   2          27d
kube-system          kube-flannel-ds-bpkkc                     1/1     Running   2          27d
local-path-storage   local-path-provisioner-7c795b5576-mt69b   1/1     Running   0          5h38m
#node1
[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                                                           COMMAND                  CREATED             STATUS              PORTS               NAMES
c7dff0a4c87b        bitnami/mysqld-exporter "/bin/bash -ec 'pass…"   4 hours ago         Up 4 hours                              k8s_metrics_mysql-primary-0_component_a585312d-4f91-46e2-a06a-8d8c5bcba493_0
30832a206c86        bitnami/mysql     "/opt/bitnami/script…"   4 hours ago         Up 4 hours                              k8s_mysql_mysql-primary-0_component_a585312d-4f91-46e2-a06a-8d8c5bcba493_0
972771a0c0ab        registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.2   "/pause"                 4 hours ago   Up 4 hours   k8s_POD_mysql-primary-0_component_a585312d-4f91-46e2-a06a-8d8c5bcba493_0
[root@localhost mysql]# kubectl get svc -A
NAMESPACE     NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
component     mysql-metrics              ClusterIP   10.254.250.224   <none>        9104/TCP                 5h47m
component     mysql-primary              NodePort    10.254.216.254   <none>        3306:30336/TCP           5h47m
component     mysql-primary-headless     ClusterIP   None             <none>        3306/TCP                 5h47m
component     mysql-secondary            ClusterIP   10.254.93.194    <none>        3306/TCP                 5h47m
component     mysql-secondary-headless   ClusterIP   None             <none>        3306/TCP                 5h47m
default       kubernetes                 ClusterIP   10.254.0.1       <none>        443/TCP                  28d
kube-system   kube-dns                   ClusterIP   10.254.0.2       <none>        53/UDP,53/TCP,9153/TCP   28d
[root@localhost mysql]# kubectl run mysql-client --rm --tty -i --restart='Never' --image  docker.io/bitnami/mysql:8.0.32-debian-11-r14 --namespace component --env MYSQL_ROOT_PASSWORD=test123456 --command -- bash
If you don't see a command prompt, try pressing enter.
I have no name!@mysql-client:/$ mysql -h mysql-primary.component.svc.cluster.local -uroot -p"test123456"
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 8083
Server version: 8.0.32 Source distribution
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| my_database        |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)
mysql> show master status\G;
*************************** 1. row ***************************
             File: mysql-bin.000003
         Position: 157
     Binlog_Do_DB:
 Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.01 sec)
查看sql、io线程是否running
###slave库 操作
I have no name!@mysql-client:/$ mysql -h mysql-secondary.component.svc.cluster.local -uroot -p"test123456"
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 8173
Server version: 8.0.32 Source distribution
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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.
mysql> show slave status\G;
*************************** 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: 157
               Relay_Log_File: mysql-relay-bin.000006
                Relay_Log_Pos: 373
        Relay_Master_Log_File: mysql-bin.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes


三、分析bitnami

bitnami官网地址

拉取bitnami mysql chart

[root@localhost mysql]# helm repo add bitnami https://charts.bitnami.com/bitnami
[root@localhost mysql]# helm repo list
NAME    URL
bitnami https://charts.bitnami.com/bitnami
[root@localhost mysql]# helm search repo mysql
NAME                    CHART VERSION   APP VERSION     DESCRIPTION
bitnami/mysql           9.7.0           8.0.32          MySQL is a fast, reliable, scalable, and easy t...
bitnami/phpmyadmin      10.4.5          5.2.1           phpMyAdmin is a free software tool written in P...
bitnami/mariadb         11.5.5          10.6.12         MariaDB is an open source, community-developed ...
bitnami/mariadb-galera  7.5.4           10.6.12         MariaDB Galera is a multi-primary database clus...
[root@localhost mysql]# helm pull bitnami/mysql
[root@localhost mysql]# ll
总用量 56
-rw-r--r-- 1 root root  2933 3月  24 10:35 local-path-storage.yaml
-rw-r--r-- 1 root root 46303 3月  24 15:16 mysql-9.7.0.tgz
[root@localhost mysql]# tar xf mysql-9.7.0.tgz
[root@localhost mysql]# cd mysql
[root@localhost mysql]# ll
总用量 140
-rw-r--r-- 1 root root   219 3月  23 01:37 Chart.lock
drwxr-xr-x 3 root root    20 3月  24 14:26 charts #子chart
-rw-r--r-- 1 root root   787 3月  23 01:37 Chart.yaml
-rw-r--r-- 1 root root 68526 3月  23 01:37 README.md
drwxr-xr-x 4 root root   290 3月  24 14:26 templates #总的模板目录
-rw-r--r-- 1 root root  5495 3月  23 01:37 values.schema.json
-rw-r--r-- 1 root root 53803 3月  23 01:37 values.yaml #变量修改地方
[root@localhost mysql]# tree templates
templates
├── extra-list.yaml
├── _helpers.tpl
├── metrics-svc.yaml #metrics svc
├── networkpolicy.yaml
├── NOTES.txt
├── primary  #主库
│   ├── configmap.yaml
│   ├── initialization-configmap.yaml #初始化配置
│   ├── pdb.yaml
│   ├── statefulset.yaml #默认副本为1,metrics
│   ├── svc-headless.yaml
│   └── svc.yaml
├── prometheusrule.yaml
├── rolebinding.yaml
├── role.yaml
├── secondary #从库
│   ├── configmap.yaml
│   ├── pdb.yaml
│   ├── statefulset.yaml
│   ├── svc-headless.yaml
│   └── svc.yaml
├── secrets.yaml
├── serviceaccount.yaml
└── servicemonitor.yaml


四、拓展

1、更新版本和查看历史版本

[root@localhost mysql]# kubectl get svc -A
NAMESPACE     NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
component     mysql-metrics              ClusterIP   10.254.250.224   <none>        9104/TCP                 5h47m
component     mysql-primary              NodePort    10.254.216.254   <none>        3306:30336/TCP           5h47m
component     mysql-primary-headless     ClusterIP   None             <none>        3306/TCP                 5h47m
component     mysql-secondary            ClusterIP   10.254.93.194    <none>        3306/TCP                 5h47m
component     mysql-secondary-headless   ClusterIP   None             <none>        3306/TCP                 5h47m
default       kubernetes                 ClusterIP   10.254.0.1       <none>        443/TCP                  28d
kube-system   kube-dns                   ClusterIP   10.254.0.2       <none>        53/UDP,53/TCP,9153/TCP   28d
##若需要从库被navicat链接到参与查询,需要把该release进行更新
# helm upgrade -f values.yaml chartname 远程chart -n namespace
# helm history chartname -n namespace
[root@localhost mysql]# cat values.yaml
global:
  storageClass: "local-path"
auth:
  rootPassword: test123456
architecture: replication
metrics:
  enabled: true
primary:
  service:
    type: NodePort
    nodePorts:
      mysql: "30336"
secondary:
  service:
    type: NodePort
    nodePorts:
      mysql: "30366"
[root@localhost mysql]# helm history mysql -n component
REVISION        UPDATED             STATUS          CHART           APP VERSION     DESCRIPTION
1          Fri Mar 24 10:41:28 2023    deployed      mysql-9.7.0     8.0.32     Install complete
[root@localhost mysql]# helm upgrade -f values.yaml mysql bitnami/mysql -n component
Release "mysql" has been upgraded. Happy Helming!
NAME: mysql
LAST DEPLOYED: Fri Mar 24 16:36:53 2023
NAMESPACE: component
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
CHART NAME: mysql
CHART VERSION: 9.7.0
APP VERSION: 8.0.32
[root@localhost mysql]# helm history mysql -n component
REVISION        UPDATED                         STATUS          CHART           APP VERSION     DESCRIPTION
1               Fri Mar 24 10:41:28 2023        superseded      mysql-9.7.0     8.0.32          Install complete
2               Fri Mar 24 16:36:53 2023        deployed        mysql-9.7.0     8.0.32          Upgrade complete
###从库service类型变化为nodeport
[root@localhost mysql]# kubectl get svc -A
NAMESPACE     NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
component     mysql-metrics              ClusterIP   10.254.250.224   <none>        9104/TCP                 5h55m
component     mysql-primary              NodePort    10.254.216.254   <none>        3306:30336/TCP           5h55m
component     mysql-primary-headless     ClusterIP   None             <none>        3306/TCP                 5h55m
component     mysql-secondary            NodePort    10.254.93.194    <none>        3306:30366/TCP           5h55m
component     mysql-secondary-headless   ClusterIP   None             <none>        3306/TCP                 5h55m
default       kubernetes                 ClusterIP   10.254.0.1       <none>        443/TCP                  28d
kube-system   kube-dns                   ClusterIP   10.254.0.2       <none>        53/UDP,53/TCP,9153/TCP   28d

若service type为clusterip临时给图形化连接

# kubectl port-forward --address=ip pods/cluster-mysql-primary-0 port


2、版本回滚

#helm rollback chartname 1 回滚到第一个版本
[root@localhost mysql]# helm rollback mysql 1  -n component
Rollback was a success! Happy Helming!
[root@localhost mysql]# helm history mysql -n component
REVISION        UPDATED                         STATUS          CHART           APP VERSION     DESCRIPTION
1               Fri Mar 24 10:41:28 2023        superseded      mysql-9.7.0     8.0.32          Install complete
2               Fri Mar 24 16:36:53 2023        superseded      mysql-9.7.0     8.0.32          Upgrade complete
3               Fri Mar 24 16:43:21 2023        deployed        mysql-9.7.0     8.0.32          Rollback to 1

3、替换值安装时只是测试不安装

# helm install --debug --dry-run chartname chart文件 -n names


相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
21天前
|
SQL Java 关系型数据库
MySQL原理简介—3.生产环境的部署压测
本文介绍了Java系统和数据库在高并发场景下的压测要点: 1. 普通系统在4核8G机器上每秒能处理几百个请求 2. 高并发下数据库建议使用8核16G或更高配置的机器 3. 数据库部署后需进行基准压测,以评估其最大承载能力 4. QPS和TPS的区别及重要性 5. 压测时需关注IOPS、吞吐量、延迟 6. 除了QPS和TPS,还需监控CPU、内存、磁盘IO、网络带宽 7. 影响每秒可处理并发请求数的因素包括线程数、CPU、内存、磁盘IO和网络带宽 8. Sysbench是数据库压测工具,可构造测试数据并模拟高并发场景 9. 在增加线程数量的同时,必须观察机器的性能,确保各硬件负载在合理范围
122 72
|
30天前
|
存储 关系型数据库 MySQL
美团面试:MySQL为什么 不用 Docker部署?
45岁老架构师尼恩在读者交流群中分享了关于“MySQL为什么不推荐使用Docker部署”的深入分析。通过系统化的梳理,尼恩帮助读者理解为何大型MySQL数据库通常不使用Docker部署,主要涉及性能、管理复杂度和稳定性等方面的考量。文章详细解释了有状态容器的特点、Docker的资源隔离问题以及磁盘IO性能损耗,并提供了小型MySQL使用Docker的最佳实践。此外,尼恩还介绍了Share Nothing架构的优势及其应用场景,强调了配置管理和数据持久化的挑战。最后,尼恩建议读者参考《尼恩Java面试宝典PDF》以提升技术能力,更好地应对面试中的难题。
|
1月前
|
SQL 关系型数据库 MySQL
docker-compose部署mysql8
使用docker-compose容器化部署mysql8
|
2月前
|
NoSQL Java 关系型数据库
Liunx部署java项目Tomcat、Redis、Mysql教程
本文详细介绍了如何在 Linux 服务器上安装和配置 Tomcat、MySQL 和 Redis,并部署 Java 项目。通过这些步骤,您可以搭建一个高效稳定的 Java 应用运行环境。希望本文能为您在实际操作中提供有价值的参考。
203 26
|
2月前
|
Java 关系型数据库 MySQL
如何将Spring Boot + MySQL应用程序部署到Pivotal Cloud Foundry (PCF)
如何将Spring Boot + MySQL应用程序部署到Pivotal Cloud Foundry (PCF)
84 5
|
4月前
|
关系型数据库 MySQL 数据库
使用Docker部署的MySQL数据库,数据表里的中文读取之后变成问号,如何处理?
【10月更文挑战第1天】使用Docker部署的MySQL数据库,数据表里的中文读取之后变成问号,如何处理?
141 3
|
4月前
|
存储 关系型数据库 MySQL
【MySQL精装典藏版】MySQL的安装与部署
【MySQL精装典藏版】MySQL的安装与部署
66 0
|
1月前
|
关系型数据库 MySQL 数据库连接
数据库连接工具连接mysql提示:“Host ‘172.23.0.1‘ is not allowed to connect to this MySQL server“
docker-compose部署mysql8服务后,连接时提示不允许连接问题解决
|
22天前
|
关系型数据库 MySQL 数据库
Docker Compose V2 安装常用数据库MySQL+Mongo
以上内容涵盖了使用 Docker Compose 安装和管理 MySQL 和 MongoDB 的详细步骤,希望对您有所帮助。
122 42
|
13天前
|
关系型数据库 MySQL 网络安全
如何排查和解决PHP连接数据库MYSQL失败写锁的问题
通过本文的介绍,您可以系统地了解如何排查和解决PHP连接MySQL数据库失败及写锁问题。通过检查配置、确保服务启动、调整防火墙设置和用户权限,以及识别和解决长时间运行的事务和死锁问题,可以有效地保障应用的稳定运行。
67 25