gpt4 book ai didi

mongodb.lock 权限被拒绝

转载 作者:可可西里 更新时间:2023-11-01 09:11:03 26 4
gpt4 key购买 nike

在 Arch Linux 64 位上使用 MongoDb。全新安装。以 root 身份尝试:

/etc/rc.d/mongodb start

日志说:

***** SERVER RESTARTED *****


Thu Mar 15 12:00:18 BackgroundJob starting: DataFileSync
Thu Mar 15 12:00:18 versionCmpTest passed
Thu Mar 15 12:00:18 versionArrayTest passed
Thu Mar 15 12:00:18 shardObjTest passed
Thu Mar 15 12:00:18 shardKeyTest passed
Thu Mar 15 12:00:18 isInRangeTest passed
Thu Mar 15 12:00:18 [initandlisten] MongoDB starting : pid=580 port=27017 dbpath=/data/db 64-bit host=(none)
Thu Mar 15 12:00:18 [initandlisten] db version v2.0.3, pdfile version 4.5
Thu Mar 15 12:00:18 [initandlisten] git version: nogitversion
Thu Mar 15 12:00:18 [initandlisten] build info: Linux brynhild.archlinux.org 3.2.6-1-ARCH #1 SMP PREEMPT Tue Feb 14 09:11:26 CET 2012 x86_64 BOOST_LIB_VERSION=1_49
Thu Mar 15 12:00:18 [initandlisten] options: { config: "/etc/mongodb.conf", dbpath: "/data/db", fork: true, journal: "true", logappend: "true", logpath: "/var/log/mongodb/mongodb.log", port: 27017, rest: "true", vvvv: "true" }
Thu Mar 15 12:00:18 [initandlisten] User Assertion: 10309:Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?
Thu Mar 15 12:00:18 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Thu Mar 15 12:00:18 dbexit:
Thu Mar 15 12:00:18 [initandlisten] shutdown: going to close listening sockets...
Thu Mar 15 12:00:18 [initandlisten] shutdown: going to flush diaglog...
Thu Mar 15 12:00:18 [initandlisten] shutdown: going to close sockets...
Thu Mar 15 12:00:18 [initandlisten] shutdown: waiting for fs preallocator...
Thu Mar 15 12:00:18 [initandlisten] shutdown: lock for final commit...
Thu Mar 15 12:00:18 [initandlisten] shutdown: final commit...
Thu Mar 15 12:00:18 [initandlisten] shutdown: closing all files...
Thu Mar 15 12:00:18 [initandlisten] closeAllFiles() finished
Thu Mar 15 12:00:18 [initandlisten] shutdown: removing fs lock...
Thu Mar 15 12:00:18 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Thu Mar 15 12:00:18 dbexit: really exiting now

目录和文件权限:

[root@(none) ~]# ls -lisa /data/db/
total 12
262711 4 drwxr-xr-x 3 root root 4096 Mar 15 11:43 .
262710 4 drwxr-xr-x 3 root root 4096 Mar 15 11:25 ..
262714 4 drwxr-xr-x 2 root root 4096 Mar 15 11:43 journal
261775 0 -rwxr-xr-x 1 root root 0 Mar 15 11:43 mongod.lock

MongoDB 配置文件:

port = 27017
dbpath = /data/db
logpath = /var/log/mongodb/mongodb.log
logappend = true
vvvv = true
journal = true
rest = true

我可以通过mongod启动一个MongoDB实例,但不能像上面那样在后台启动。任何帮助都会很棒,谢谢。

最佳答案

我验证了/etc/rc.d/mongodb,我认为它会使用 mongodb 用户来运行服务:

[ -z "$PID" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf --fork" > /dev/null

我认为这个错误可能是使用root运行mongod导致的,所以将mongod.lock的所有者更改为root。

关于mongodb.lock 权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9713064/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com