rancher2部署MySQL无法挂载Longhorn创建的pvc,怎么办?
2021/6/30 19:22:20
本文主要是介绍rancher2部署MySQL无法挂载Longhorn创建的pvc,怎么办?,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
环境描述:
rancher版本:v2.5.7
Longhorn版本:v1.1.1
MySQL版本:v5.7.26
问题描述:
在rancher界面部署MySQL,在“数据卷”处创建一个Longhorn的pvc持久化挂载/var/lib/mysql目录,MySQL无法启动,报错日志如下:
2021/6/30 下午5:27:45 Initializing database 2021/6/30 下午5:27:45 2021-06-30T09:27:45.961062Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2021/6/30 下午5:27:45 2021-06-30T09:27:45.964617Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2021/6/30 下午5:27:45 2021-06-30T09:27:45.964676Z 0 [ERROR] Aborting
问题原因:
因为Longhorn为块存储设备,在创建一个pvc时,会自动创建一个lost+found目录, mysql 初始化的时候 data 目录是不能有任何文件的,所以报 initialize specified but the data directory has files in it.
拿了一个redis做实验,挂载目录下确实有一个lost+found目录:
解决方法:
根据MySQL官方提示(链接:https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_ignore-db-dir),在启动命令处加入一条“--ignore-db-dir=lost+found”即可解决。
在rancher上部署的MySQL,可以加在“入口/命令”的位置,如下截图:
这篇关于rancher2部署MySQL无法挂载Longhorn创建的pvc,怎么办?的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-25MySQL报错Duplicate entry '0' for key 'PRIMARY'
- 2024-05-29阿里 Canal 实时同步 MySQL 增量数据至 ClickHouse 数据库
- 2024-05-24在Linux下管理MySQL的大小写敏感性
- 2024-04-26MySQL查出时间比实际晚8小时的解决方案
- 2024-04-01JPA不识别MySQL的枚举类型
- 2024-03-30mysql数据库表卡死解决方法
- 2024-03-15MySQL多数据源笔记5-ShardingJDBC实战
- 2024-03-11natural join mysql
- 2024-03-11关于VS2017,VS2015 中利用 EF使用Mysql 不显示数据源问题解决方案
- 2024-02-26mysql 阿里云xb后缀备份文件恢复-icode9专业技术文章分享