Mysql-K8S运维-修改服务max_connections
需求
- 修改mysql max_connections,但ClusterIP不变
操作
- 登录mysql所在pod
- 查找mysql配置文件,例如 /etc/mysql/my.conf
- 查看现有mysql配置信息,使用数据库工具
show variables like "%max_connections%"; - 更新配置文件,若之前不存在max_connections相关配置,则直接追加
echo "max_connections=1024" >> /etc/mysql/my.conf - 查看mysql pod所在node
kubectl get pods -n XXX -o wide | grep mysql - docker ps | grep mysql
查看容器id,假设id为 8e4e9790aef8 - 重启
docker restart 8e4e9790aef8