我正在尝试使用Kubernetes在Digital Ocean上设置一个MySQL pod。
我一直收到此错误:
application(_:didReceiveRemoteNotification:fetchCompletionHandler:)
我的Yaml有很多东西,但下面是配置这一部分感兴趣的行。
Initializing database
2019-03-05T14:32:58.707421Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-03-05T14:32:58.708753Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2019-03-05T14:32:58.711746Z 0 [ERROR] Aborting
如果我在部署配置中注释掉PVC和相对于PVC的行,则一切正常。
此外,如果我更改
# ------------------- Persistent Volume Claim ------------------- #
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: test-mysql-volume-claim
...
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: do-block-storage
---
# ------------------- Deployment ------------------- #
kind: Deployment
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
...
spec:
...
spec:
containers:
- image: mysql:5.7
...
volumeMounts:
- name: test-mysql-volume
mountPath: "/var/lib/mysql"
volumes:
- name: test-mysql-volume
persistentVolumeClaim:
claimName: test-mysql-volume-claim
---
到
mountPath: "/var/lib/mysql"
有效。但我显然需要mountPath: "/data"
...
它在崭新的集群上也发生。
有什么主意吗?
答案 0 :(得分:6)
我在使用 Kubernetes 和 MySQL 5.7 时也遇到了这个问题。
将来自 yosifki 的建议添加到我的容器定义中,一切正常。
<块引用>一个新的 ext4 磁盘分区通常不是空的; 有一个 lost+found 目录,已知 mysql 会阻塞它。你 可以尝试将 --ignore-db-dir=lost+found 添加到 CMD 以了解 确定(来自mysql docs)
这是我的工作 YAML 定义的摘录:
name: mysql-master
image: mysql:5.7
args:
- "--ignore-db-dir=lost+found"
答案 1 :(得分:1)
我遇到了这个问题。解决方法是删除pv和pvc并重新创建它们。
答案 2 :(得分:0)