我需要安装一个具有大量数据存储的mongodb实例。我们有一个数百TB的Lustre FS,但当monodb开始向我显示这个错误时:
Mon Jul 15 12:06:50.898 [initandlisten] exception in initAndListen: 10310 Unable to lock file: /var/lib/mongodb/mongod.lock. Is a mongod instance already running?, terminating
Mon Jul 15 12:06:50.898 dbexit:
但权限应该很好:
# ls -lart /project/mongodb/
total 8
drwxr-xr-x 19 root root 4096 Jul 15 11:12 ..
-rwxr-xr-x 1 mongod mongod 0 Jul 15 11:54 mongod.lock
drwxr-xr-x 2 mongod mongod 4096 Jul 15 12:10 .
没有其他运行过程:
# ps -fu mongod
UID PID PPID C STIME TTY TIME CMD
#
有人这样做过吗(Lustre+mongodb)
# rm mongod.lock
rm: remove regular empty file `mongod.lock'? y
# ls -lrt
total 0
# ls -lart
total 8
drwxr-xr-x 19 root root 4096 Jul 15 11:12 ..
drwxr-xr-x 2 mongod mongod 4096 Jul 15 12:10 .
# ps aux | grep mongod
root 25865 0.0 0.0 103296 884 pts/15 S+ 13:04 0:00 grep mongod
# service mongod start
Starting mongod: about to fork child process, waiting until server is ready for connections.
forked process: 25935
all output going to: /var/log/mongo/mongod.log
ERROR: child process failed, exited with error number 100
[FAILED]
我意识到这是一个老问题,但我觉得我应该澄清事实。
MongoDB、任何DB或任何应用程序都可以在没有问题的光泽文件系统上运行。但是,默认情况下,光泽客户端不会显式设置user_xattr或flock(启用)。
在安装文件系统时设置-o flock
甚至-o localflock
就可以解决这个问题。