我只需要紧急重启我的linux服务器。我做得很优雅,而不是硬重启。我一直在通过node.js应用程序收集数据一个月,但是当服务器再次启动时,所有数据都消失了!
我有一个很长的日志文件:http://clintberry.com/mongod.log
我也进行了修理以确定它是否会有所帮助但无济于事。
新发展 看起来我用命令'service mongod start'运行mongo,当我再次尝试运行该命令时,我得到了这个:
**************
old lock file: /var/lib/mongo/mongod.lock. probably means unclean shutdown recommend
removing file and running --repair see: http://dochub.mongodb.org/core/repair
for more information
*************
这意味着我正在尝试的修复因为我没有使用正确的配置文件而无法正常工作。
当我使用正确的配置文件运行修复时,它似乎没有运行修复,只是吐出这个:
root@es2 [/var/log/mongo]# mongod --dbpath /var/lib/mongo/ --repair
Wed Nov 30 12:09:40 [initandlisten] MongoDB starting : pid=26916 port=27017 dbpath=/var/lib/mongo/ 64-bit
Wed Nov 30 12:09:40 [initandlisten] db version v1.8.4, pdfile version 4.5
Wed Nov 30 12:09:40 [initandlisten] git version: 81f12749a15e3d158b1b16bab6bc3faea538e166
Wed Nov 30 12:09:40 [initandlisten] build sys info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
**************
old lock file: /var/lib/mongo/mongod.lock. probably means unclean shutdown
recommend removing file and running --repair
see: http://dochub.mongodb.org/core/repair for more information
*************
Wed Nov 30 12:09:40 [initandlisten] exception in initAndListen std::exception: old lock file, terminating
Wed Nov 30 12:09:40 dbexit:
Wed Nov 30 12:09:40 [initandlisten] shutdown: going to close listening sockets...
Wed Nov 30 12:09:40 [initandlisten] shutdown: going to flush diaglog...
Wed Nov 30 12:09:40 [initandlisten] shutdown: going to close sockets...
Wed Nov 30 12:09:40 [initandlisten] shutdown: waiting for fs preallocator...
Wed Nov 30 12:09:40 [initandlisten] shutdown: closing all files...
Wed Nov 30 12:09:40 closeAllFiles() finished
Wed Nov 30 12:09:40 dbexit: really exiting now
答案 0 :(得分:0)
正如 mpobrien 的评论建议的那样,问题是当启动mongo时它使用的是不同的dbpath(数据的位置)。对于那些在CentOS上安装mongo的用户,如果使用service命令启动mongo,
service mongod start
然后mongo将在启动时使用配置文件/etc/mongo.conf,这会将dbpath设置为/ var / lib / mongo
但如果你使用常规mongod命令启动mongo,它将不会使用该文件夹并将使用mongo默认值。
感谢您的帮助。