[英]How to resolve --initialize specified but the data directory has files in it. on laradock mysql container
[英]Cannot deploy MySQL pod. --initialize specified but the data directory has files in it
我正在嘗試使用 Kubernetes 在 Digital Ocean 上設置一個 MySQL pod。
我不斷收到此錯誤:
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
我的 yaml 有很多東西,但對這部分配置感興趣的行如下。
# ------------------- 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
---
如果我在部署配置中注釋掉 PVC 和與 PVC 相關的行,一切正常。
另外,如果我改變
mountPath: "/var/lib/mysql"
到
mountPath: "/data"
有用。 但我顯然需要/var/lib/mysql
...
它也發生在全新的集群上。
任何的想法?
我在 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"
我遇到過這個問題。 解決方法是刪除 pv 和 pvc 並重新創建它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.