我正在按照 helm 图表 运行在 azure aks 中运行的 Mysql 数据库。最初,数据库按预期运行,直到此日志开始出现:
[Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
应用了此处的建议来解决问题,但日志语句仍然出现
升级图表后,pod 继续关闭并显示以下日志:
[System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.35).
这些是我添加到版本 9.14.1 的自定义值
architecture: replication
secondary:
replicaCount: 2
metrics:
enabled: true
我能够端口转发 mysql-metrics 服务,但不确定要在日志中查找什么。
这是一个小型数据库,由 5 个表组成,每个表不到 1000 行
查看命名空间的事件,发现内存不足:
The node was low on resource: memory. Container mysql was using 421440Ki, which exceeds its request of 0. Container metrics was using 15092Ki, which exceeds its request of 0.
但启用自动缩放后,Pod 仍会重新启动
警告仅供参考,不应导致 Pod 重新启动。您遇到的问题可能与其他一些配置问题有关。根据 Excessivelogging thread ,不要升级 helm,而是尝试创建一个新的命名空间,并在添加 test.yaml
后重新安装它。它应该可以正常工作,正如您在日志中看到的那样 -
2023-10-27T09:44:21.538670Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-10-27T09:44:21.704571Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-10-27T09:44:21.911205Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-10-27T09:44:21.911239Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-10-27T09:44:21.926974Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2023-10-27T09:44:21.927008Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld: ready for connections. Version: '8.0.31' socket: '/opt/bitnami/mysql/tmp/mysql.sock' port: 3306 Source distribution.
我正在使用 mysql helm-chart,如下所示-
PS C:\Windows\system32> kubectl create namespace mysql
namespace/mysql created
PS C:\Windows\system32> kubectl get ns
NAME STATUS AGE
default Active 16m
gatekeeper-system Active 16m
kube-node-lease Active 16m
kube-public Active 16m
kube-system Active 16m
mysql Active 3s
PS C:\Windows\system32> kubectl config set-context --current --namespace=mysql
Context "MySQL" modified.
PS C:\Windows\system32> helm install mysql azure-marketplace/mysql
NAME: mysql
LAST DEPLOYED: Fri Oct 27 15:12:59 2023
NAMESPACE: mysql
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: mysql
CHART VERSION: 9.4.3
APP VERSION: 8.0.31
** Please be patient while the chart is being deployed **
Tip:
Watch the deployment status using the command: kubectl get pods -w --namespace mysql
Services:
echo Primary: mysql.mysql.svc.cluster.local:3306
Execute the following to get the administrator credentials:
echo Username: root
MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace mysql mysql -o jsonpath="{.data.mysql-root-password}" | base64 -d)
Pod 已启动
PS C:\Windows\system32> kubectl get pods
NAME READY STATUS RESTARTS AGE
mysql-0 1/1 Running 0 11m
mysql-client 1/1 Running 0 4m41s
可以访问数据库