按照说明操作后,MongoDB无法连接到C9

时间:2017-07-09 15:07:39

标签: javascript mongodb cloud9-ide cloud9 c9.io

我试图连接到mongodb。我以前做过。但是在暂时不使用c9之后,我的数据库服务器被关闭了。因此,我必须按照c9网站提供的说明操作:link1link2

任何人都可以向我解释为什么我会收到此错误。感谢

roadtocode2:~/workspace $ ./mongod
2017-07-09T15:02:38.483+0000 ** WARNING: --rest is specified without --httpinterface,
2017-07-09T15:02:38.483+0000 **          enabling http interface
warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
2017-07-09T15:02:38.485+0000 [initandlisten] MongoDB starting : pid=4054 port=27017 dbpath=data 64-bit host=roadtocode2-node-crud-traversy-4943954
2017-07-09T15:02:38.485+0000 [initandlisten] db version v2.6.12
2017-07-09T15:02:38.485+0000 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2017-07-09T15:02:38.485+0000 [initandlisten] build info: Linux build5.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2017-07-09T15:02:38.485+0000 [initandlisten] allocator: tcmalloc
2017-07-09T15:02:38.485+0000 [initandlisten] options: { net: { bindIp: "0.0.0.0", http: { RESTInterfaceEnabled: true, enabled: true } }, storage: { dbPath: "data", journal: { enabled: false } } }
************** 
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
2017-07-09T15:02:38.485+0000 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
2017-07-09T15:02:38.485+0000 [initandlisten] dbexit: 
2017-07-09T15:02:38.485+0000 [initandlisten] shutdown: going to close listening sockets...
2017-07-09T15:02:38.485+0000 [initandlisten] shutdown: going to flush diaglog...
2017-07-09T15:02:38.485+0000 [initandlisten] shutdown: going to close sockets...
2017-07-09T15:02:38.486+0000 [initandlisten] shutdown: waiting for fs preallocator...
2017-07-09T15:02:38.486+0000 [initandlisten] shutdown: closing all files...
2017-07-09T15:02:38.486+0000 [initandlisten] closeAllFiles() finished
2017-07-09T15:02:38.486+0000 [initandlisten] dbexit: really exiting now
roadtocode2:~/workspace $ sudo apt-get install -y mongodb-org

Reading package lists... Done
Building dependency tree       
Reading state information... Done
mongodb-org is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
roadtocode2:~/workspace $ 
roadtocode2:~/workspace $ mongod --bind_ip=$IP --nojournal
warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
2017-07-09T15:02:58.664+0000 [initandlisten] MongoDB starting : pid=4074 port=27017 dbpath=/data/db 64-bit host=roadtocode2-node-crud-traversy-4943954
2017-07-09T15:02:58.664+0000 [initandlisten] db version v2.6.12
2017-07-09T15:02:58.664+0000 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2017-07-09T15:02:58.664+0000 [initandlisten] build info: Linux build5.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2017-07-09T15:02:58.664+0000 [initandlisten] allocator: tcmalloc
2017-07-09T15:02:58.664+0000 [initandlisten] options: { net: { bindIp: "0.0.0.0" }, storage: { journal: { enabled: false } } }
************** 
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
2017-07-09T15:02:58.664+0000 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
2017-07-09T15:02:58.664+0000 [initandlisten] dbexit: 
2017-07-09T15:02:58.664+0000 [initandlisten] shutdown: going to close listening sockets...
2017-07-09T15:02:58.664+0000 [initandlisten] shutdown: going to flush diaglog...
2017-07-09T15:02:58.664+0000 [initandlisten] shutdown: going to close sockets...
2017-07-09T15:02:58.664+0000 [initandlisten] shutdown: waiting for fs preallocator...
2017-07-09T15:02:58.665+0000 [initandlisten] shutdown: closing all files...
2017-07-09T15:02:58.665+0000 [initandlisten] closeAllFiles() finished
2017-07-09T15:02:58.665+0000 [initandlisten] dbexit: really exiting now

1 个答案:

答案 0 :(得分:1)

这很可能是由于工作空间由于不活动而被Cloud9自动存档和关闭。日志似乎指向不洁的关闭;我建议按照MongoDB提供的步骤恢复数据库...此时的过程看起来就是备份数据库并运行修复命令:https://docs.mongodb.com/manual/tutorial/recover-data-following-unexpected-shutdown/