我有一个主节点和一个工作节点。我正在为mysql运行一个带有pv/pvc/persistant卷声明的yaml。日志显示mysql找到(每次重启时)数据库保存的前一个目录(用于持久化)。即使我删除了文件/directory /var/lib/mysql,mysql服务器仍然以某种方式检测到它。下面是日志:
] /usr/sbin/mysqld (mysqld 8.0.33) initializing of server in progress as process 10
2023-06-29T16:30:30.612865Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2023-06-29T16:30:30.612875Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2023-06-29T16:30:30.614055Z 0 [ERROR] [MY-010119] [Server] Aborting
字符串
我尝试了--ignore-db-dir=lost+found
和fsGgroup: 1000
,因为我在谷歌上找到了这些解决方案,但它们不适合我。这是我的yaml文件:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
securityContext:
fsGroup: 10000
tolerations:
- key: "app"
operator: "Equal"
value: "mysql"
effect: "NoSchedule"
containers:
- name: mysql
image: mysql:latest
env:
- name: MYSQL_ROOT_PASSWORD
value: mypassword
ports:
- containerPort: 3306
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
args:
- --datadir=/var/lib/mysql
- "--ignore-db-dir=lost+found"
- --initialize
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv
- name: mysql-data
emptyDir: {}
型
1条答案
按热度按时间enxuqcxy1#
我通过逐行检查yaml清单并将配置减少到以下内容来解决这个问题:
字符串