我已经在RPI上运行了几个星期的MongoDB,突然间它不会启动。我知道有很多类似的问题,纠正权限似乎有效。但是,这对我没用。
我怀疑RPI断电导致了这个问题,但我不知道如何解决它。
我得到以下终端输出:
$ sudo service mongodb start
[FAIL] Starting database: mongodb failed!
更多详细信息显示在' mongod'命令:
$ mongod
db level locking enabled: 1
mongod --help for help and startup options
Fri Aug 28 14:04:06
Fri Aug 28 14:04:06 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Fri Aug 28 14:04:06
Fri Aug 28 14:04:06 [initandlisten] MongoDB starting : pid=4036 port=27017 dbpath=/data/db/ 32-bit host=raspberrypi
Fri Aug 28 14:04:06 [initandlisten]
Fri Aug 28 14:04:06 [initandlisten] ** NOTE: This is a development version (2.1.1) of MongoDB.
Fri Aug 28 14:04:06 [initandlisten] ** Not recommended for production.
Fri Aug 28 14:04:06 [initandlisten]
Fri Aug 28 14:04:06 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Fri Aug 28 14:04:06 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Fri Aug 28 14:04:06 [initandlisten] ** with --journal, the limit is lower
Fri Aug 28 14:04:06 [initandlisten]
Fri Aug 28 14:04:06 [initandlisten] db version v2.1.1, pdfile version 4.5
Fri Aug 28 14:04:06 [initandlisten] git version: f457ff42ec37f2562d1a5ff06b4d96a861414c94
Fri Aug 28 14:04:06 [initandlisten] build info: Linux piplusraspbian 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l BOOST_LIB_VERSION=1_49
Fri Aug 28 14:04:06 [initandlisten] options: {}
Fri Aug 28 14:04:06 [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
Fri Aug 28 14:04:06 dbexit:
Fri Aug 28 14:04:06 [initandlisten] shutdown: going to close listening sockets...
Fri Aug 28 14:04:06 [initandlisten] shutdown: going to flush diaglog...
Fri Aug 28 14:04:06 [initandlisten] shutdown: going to close sockets...
Fri Aug 28 14:04:06 [initandlisten] shutdown: waiting for fs preallocator...
Fri Aug 28 14:04:06 [initandlisten] shutdown: closing all files...
Fri Aug 28 14:04:06 [initandlisten] closeAllFiles() finished
Fri Aug 28 14:04:06 [initandlisten] shutdown: removing fs lock...
Fri Aug 28 14:04:06 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Fri Aug 28 14:04:06 dbexit: really exiting now
/ data / db确实存在并且似乎拥有正确的权限:
$ ls -l /data
total 8
drwxr-xr-x 2 mongodb mongodb 4096 Aug 28 14:37 db
drwxr-xr-x 4 mongodb mongodb 4096 Aug 28 09:44 db_backup
已将db的内容复制到db_backup以检查是否有任何更改,但它没有。 db内容权限似乎也很好:
$ ls -l /data/db_backup
total 131100
drwxr-xr-x 2 mongodb mongodb 4096 Aug 28 09:44 client-db
-rw------- 1 mongodb mongodb 16777216 Aug 28 09:44 client-db.0
-rw------- 1 mongodb mongodb 33554432 Aug 28 09:44 client-db.1
-rw------- 1 mongodb mongodb 16777216 Aug 28 09:44 client-db.ns
-rwxr-xr-x 1 mongodb mongodb 0 Aug 28 13:52 mongod.lock
drwxr-xr-x 2 mongodb mongodb 4096 Aug 28 09:44 myproject
-rw------- 1 mongodb mongodb 16777216 Aug 28 09:44 myproject.0
-rw------- 1 mongodb mongodb 33554432 Aug 28 09:44 myproject.1
-rw------- 1 mongodb mongodb 16777216 Aug 28 09:44 myproject.ns
我也尝试过mongod --repair,但它没有帮助。
有没有人有任何想法?
我不关心数据,因为它只是临时测试数据。
答案 0 :(得分:0)
mongo的数据目录中有一个 mongod.lock 文件,通常是 / var / lib / mongodb 。此文件的内容是mongod进程的 pid 。
如果mongod停止,则此文件的内容应为空。否则,mongod意外停止了。要修复并启动一个新的mongod进程,假设mongo的数据目录是 / var / lib / mongodb 。只需清除文件......
# ggvis Code
# Function for the tooltip
getData <- function(dat){
paste(paste("Time:", as.Date(dat$time/86400000, origin='1970-01-01') ),
paste("Group:", as.character(dat$group)),
paste("Value:", dat$val),
sep = "<br />")
}
并开始一个新的mongod进程。
# Visualisation
tdat %>% ggvis(~time, ~val, stroke = ~group) %>% layer_lines(strokeWidth := 1) %>%
layer_points(size = 1, fill = ~group, opacity := 0) %>% add_tooltip(getData)