Mysql-K8S运维-修改服务max_connections

需求

  • 修改mysql max_connections,但ClusterIP不变

操作

  1. 登录mysql所在pod
  2. 查找mysql配置文件,例如 /etc/mysql/my.conf
  3. 查看现有mysql配置信息,使用数据库工具
    show variables like "%max_connections%";
  4. 更新配置文件,若之前不存在max_connections相关配置,则直接追加
    echo "max_connections=1024" >> /etc/mysql/my.conf
  5. 查看mysql pod所在node
    kubectl get pods -n XXX -o wide | grep mysql
  6. docker ps | grep mysql
    查看容器id,假设id为 8e4e9790aef8
  7. 重启
    docker restart 8e4e9790aef8
posted @ 2025-01-07 09:04  bigbigtree  阅读(38)  评论(0)    收藏  举报