Minio集群模式报错解决:Unable to use the drive XXX: drive not found, will be retried
- 部署环境说明
- 问题描述
- 问题分析
- 验证数据目录无数据启动:
- 验证数据目录有数据启动:
- 问题总结
部署环境说明
节点共规划出四个节点,并且已经进行安装部署
虚拟机名称 | 虚拟机IP | 主机名 | 磁盘挂载 |
---|---|---|---|
centos7_01 | 192.168.0.123 | minio-01 | /dev/sdb /mnt/data1 |
centos7_02 | 192.168.0.136 | minio-02 | /dev/sdb /mnt/data1 |
centos7_03 | 192.168.0.141 | minio-03 | /dev/sdb /mnt/data1 |
centos7_04 | 192.168.0.163 | minio-04 | /dev/sdb /mnt/data1 |
而且使用脚本启动是可以正常访问
export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=miniostorage
nohup minio server --config-dir /etc/minio --address ":9000" --console-address ":9001" \
http://minio-01/mnt/data1 http://minio-02/mnt/data1 \
http://minio-03/mnt/data1 http://minio-04/mnt/data1 > minio_server.log 2>&1 &
问题描述
在参考官网将minio启动作为服务文件时,按照创建服务文件systemd
和创建服务环境文件进行配置后执行启动
sudo systemctl start minio.service
发现报错如下:
[root@minio-04 system]# journalctl -f -u minio.service
-- Logs begin at 四 2025-02-20 19:44:20 CST. --
2月 21 15:53:47 minio-04 minio[54538]: INFO: Unable to use the drive http://minio-01:9000/mnt/data1: drive not found, will be retried
2月 21 15:53:47 minio-04 minio[54538]: INFO: Unable to use the drive http://minio-02:9000/mnt/data1: drive not found, will be retried
2月 21 15:53:47 minio-04 minio[54538]: INFO: Unable to use the drive http://minio-03:9000/mnt/data1: drive not found, will be retried
2月 21 15:53:47 minio-04 minio[54538]: INFO: Unable to use the drive http://minio-04:9000/mnt/data1: drive not found, will be retried
2月 21 15:53:47 minio-04 minio[54538]: INFO: Waiting for a minimum of 2 drives to come online (elapsed 1m25s)
2月 21 15:53:48 minio-04 minio[54538]: INFO: Unable to use the drive http://minio-01:9000/mnt/data1: drive not found, will be retried
2月 21 15:53:48 minio-04 minio[54538]: INFO: Unable to use the drive http://minio-02:9000/mnt/data1: drive not found, will be retried
2月 21 15:53:48 minio-04 minio[54538]: INFO: Unable to use the drive http://minio-03:9000/mnt/data1: drive not found, will be retried
2月 21 15:53:48 minio-04 minio[54538]: INFO: Unable to use the drive http://minio-04:9000/mnt/data1: drive not found, will be retried
2月 21 15:53:48 minio-04 minio[54538]: INFO: Waiting for a minimum of 2 drives to come online (elapsed 1m26s)
问题分析
官网给出的赋权操作语句如下:
注意,这里仅仅是给 磁盘赋权 ,而不是递归赋权给所有子目录!也就是说当前的数据目录下不能有bucket和文件!
验证数据目录无数据启动:
已经执行了此操作
# 先恢复权限给root
chown -R root:root /mnt/data1
# 给磁盘赋权
chown minio-user:minio-user /mnt/data1
重启四台机器的服务,发现可以正常启动
sudo systemctl restart minio.service
验证数据目录有数据启动:
上面的操作成功后,新建了test的桶和上传了一个文件
停止服务
sudo systemctl stop minio.service
然后和上面一样操作进行赋权
# 先恢复权限给root
chown -R root:root /mnt/data1
# 给磁盘赋权
chown minio-user:minio-user /mnt/data1
重启四台机器的服务,发现启动是成功的,但是无法访问客户端
sudo systemctl restart minio.service
查看报错信息:
journalctl -f -u minio.service
解决方案:注意赋权加了 -R
# 给磁盘赋权
chown -R minio-user:minio-user /mnt/data1
直接访问成功!
问题总结
数据目录为空时的解决方案
当数据目录为空时,确保 MinIO 用户有足够权限访问磁盘目录。执行以下命令:
# 赋权给 MinIO 用户
sudo chown minio-user:minio-user /mnt/data1
# 重启 MinIO 服务
sudo systemctl restart minio.service
数据目录已有数据时的解决方案
当数据目录已经包含数据(例如桶和文件),需要递归地赋予 MinIO 用户权限。执行以下命令:
# 递归地为数据目录下的所有文件和子目录赋权给 MinIO 用户
sudo chown -R minio-user:minio-user /mnt/data1
# 重启 MinIO 服务
sudo systemctl restart minio.service
执行以下命令查看服务状态:
# 查看 MinIO 服务状态
sudo systemctl status minio.service
# 查看日志,确保没有权限相关错误
journalctl -f -u minio.service