当前位置:   article > 正文

IllegalOperation: Attempted to create a lock file on a read-only directory: /data/mongo

illegaloperation: attempted to create a lock file on a read-only directory:

sentos 7 ,systemctl start mongod 报错 ‘"attr":{"error":"IllegalOperation: Attempted to create a lock file on a read-only directory: /data/mongo"}’

解决路径:

1. 查看 /data/mongod 权限是否只读,所有组是否为mongod。

drwxrwxrwx. 2 mongod mongod 6 May 16 11:05 mongo(这是现在的权限,但是还是启动失败)

2. 检查文件系统挂载选项:确保/data目录没有以只读模式挂载。使用mount命令检查文件系统挂载情况,确保没有使用ro(只读)选项挂载/data目录。

3. 检查磁盘空间:确保/data目录所在的文件系统具有足够的可用空间。使用df -h命令检查磁盘使用情况。

4. 检查SELinux设置:如果你的系统启用了SELinux,它可能会限制MongoDB在指定目录上创建文件。你可以使用ls -Z命令检查目录的SELinux上下文,然后使用chcon命令为目录设置适当的上下文,以允许MongoDB创建文件。

sudo chcon -Rv --type=mongod_var_lib_t /data/mongo

最后再运行一次 systemctl start mongod

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/56131
推荐阅读
相关标签
  

闽ICP备14008679号