更改dbpath后Mongodb服务器未启动 [英] Mongodb server not starting up after changing dbpath
问题描述
我更改了mongodb的dbpath,并将较早的dbpath文件夹的内容移动到了新的dbpath文件夹.但是服务器没有启动.在调查mongodb日志后,我发现以下异常:
I changed dbpath of my mongodb, and moved content of earlier dbpath folder to the new one. But the server is not starting up. Upon investigating mongodb logs, I found following exception:
016-05-23T10:50:51.697 + 0000我在initAndListen std :: exception:boost :: filesystem :: status中存储了[initandlisten]异常:权限被拒绝:"/media/user/Shared/mongodb/storage. bson",终止
016-05-23T10:50:51.697+0000 I STORAGE [initandlisten] exception in initAndListen std::exception: boost::filesystem::status: Permission denied: "/media/user/Shared/mongodb/storage.bson", terminating
我在这里找到了类似的问题,但是它没有帮助我解决问题.这是我的 dbpath 文件夹和 storage.bson 文件的当前权限:
I found a similar question here, but it did not help me fix the issue. Here is the current permissions of my dbpath folder and storage.bson file:
-rwxrwxrwx 1 mongodb mongodb 69 May 23 08:57 storage.bson*
drwxrwxrwx 3 mongodb mongodb 4096 May 23 09:04 mongodb/
我确实尝试删除了锁定文件(/var/lib/mongodb/mongod.lock),但这也没有帮助我.
I did try removing lock file (/var/lib/mongodb/mongod.lock) but it also did not help me.
顺便说一句,我正在使用MongoDB的版本 v3.0.8 ,并通过它进行启动 sudo服务mongodb start
BTW, I am using version v3.0.8 of MongoDB and starting it through sudo service mongodb start
推荐答案
通过向/home上的其他用户添加可执行权限,一直到db路径,也解决了相同的问题.例如:
Had the same problem resolved by adding the executable permission to other users on the /home, and all the way down to the db path. for example:
chmod -R o+x /<home>
或更具体(注意-R递归标志)
chmod o+x /<home>
chmod -R o+x /<home>/mongodb
or more specific (notice the -R recursive flag)
chmod o+x /<home>
chmod -R o+x /<home>/mongodb
这篇关于更改dbpath后Mongodb服务器未启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!