我得到以下错误:
alex@alex-K43U:/$ mongo
MongoDB shell version: 2.2.0
connecting to: test
Thu Oct 11 11:46:53 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed
alex@alex-K43U:/$
以下是我尝试启动mongodb时发生的情况:
* Starting database mongodb [fail]
我已经试过mongo --repair
了
我将chown和chmod设置为var、lib、data/db和log mongodb。
不知道还能做什么。有什么建议吗?
mongodb.log:
***** SERVER RESTARTED *****
Thu Oct 11 08:29:40
Thu Oct 11 08:29:40 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Thu Oct 11 08:29:40
Thu Oct 11 08:29:41 [initandlisten] MongoDB starting : pid=1052 port=27017 dbpath=/var/lib/mongodb 32-bit host=alex-K43U
Thu Oct 11 08:29:41 [initandlisten]
Thu Oct 11 08:29:41 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Thu Oct 11 08:29:41 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Thu Oct 11 08:29:41 [initandlisten] ** with --journal, the limit is lower
Thu Oct 11 08:29:41 [initandlisten]
Thu Oct 11 08:29:41 [initandlisten] db version v2.2.0, pdfile version 4.5
Thu Oct 11 08:29:41 [initandlisten] git version: f5e83eae9cfbec7fb7a071321928f00d1b0c5207
Thu Oct 11 08:29:41 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_49
Thu Oct 11 08:29:41 [initandlisten] options: { config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Thu Oct 11 08:29:41 [initandlisten] Unable to check for journal files due to: boost::filesystem::basic_directory_iterator constructor: No such file or directory: "/var/lib/mongodb/journal"
**************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
Thu Oct 11 08:29:41 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
Thu Oct 11 08:29:41 dbexit:
Thu Oct 11 08:29:41 [initandlisten] shutdown: going to close listening sockets...
Thu Oct 11 08:29:41 [initandlisten] shutdown: going to flush diaglog...
Thu Oct 11 08:29:41 [initandlisten] shutdown: going to close sockets...
Thu Oct 11 08:29:41 [initandlisten] shutdown: waiting for fs preallocator...
Thu Oct 11 08:29:41 [initandlisten] shutdown: closing all files...
Thu Oct 11 08:29:41 [initandlisten] closeAllFiles() finished
Thu Oct 11 08:29:41 dbexit: really exiting now
编辑:
我删除了锁,然后进行了mongod修复,得到了这个错误:
Thu Oct 11 12:05:37 [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
所以我用sudo做了:
alex@alex-K43U:~$ sudo mongod --repair
Thu Oct 11 12:05:42
Thu Oct 11 12:05:42 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Thu Oct 11 12:05:42
Thu Oct 11 12:05:42 [initandlisten] MongoDB starting : pid=5129 port=27017 dbpath=/data/db/ 32-bit host=alex-K43U
Thu Oct 11 12:05:42 [initandlisten]
Thu Oct 11 12:05:42 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Thu Oct 11 12:05:42 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Thu Oct 11 12:05:42 [initandlisten] ** with --journal, the limit is lower
Thu Oct 11 12:05:42 [initandlisten]
Thu Oct 11 12:05:42 [initandlisten] db version v2.2.0, pdfile version 4.5
Thu Oct 11 12:05:42 [initandlisten] git version: f5e83eae9cfbec7fb7a071321928f00d1b0c5207
Thu Oct 11 12:05:42 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_49
Thu Oct 11 12:05:42 [initandlisten] options: { repair: true }
Thu Oct 11 12:05:42 [initandlisten] Unable to check for journal files due to: boost::filesystem::basic_directory_iterator constructor: No such file or directory: "/data/db/journal"
Thu Oct 11 12:05:42 [initandlisten] finished checking dbs
Thu Oct 11 12:05:42 dbexit:
Thu Oct 11 12:05:42 [initandlisten] shutdown: going to close listening sockets...
Thu Oct 11 12:05:42 [initandlisten] shutdown: going to flush diaglog...
Thu Oct 11 12:05:42 [initandlisten] shutdown: going to close sockets...
Thu Oct 11 12:05:42 [initandlisten] shutdown: waiting for fs preallocator...
Thu Oct 11 12:05:42 [initandlisten] shutdown: closing all files...
Thu Oct 11 12:05:42 [initandlisten] closeAllFiles() finished
Thu Oct 11 12:05:42 [initandlisten] shutdown: removing fs lock...
Thu Oct 11 12:05:42 dbexit: really exiting now
但是仍然有同样的问题。
发布于 2012-10-11 11:54:20
日志表明mongodb正在终止,因为有一个旧的锁文件。
如果您没有也没有使用日志记录运行,请删除锁文件,运行repair,然后再次启动mongodb。
如果您正在或曾经在运行时启用了日志记录,请参阅the relevant Mongo DB docs。请注意,他们会说“如果您正在使用日志记录运行,则不应执行修复以恢复到一致状态。”因此,如果你在写日志,修复可能会让事情变得更糟。
发布于 2013-07-23 01:36:16
Step 1: Remove lock file.
sudo rm /var/lib/mongodb/mongod.lock
Step 2: Repair mongodb.
sudo mongod --repair
Step 3: start mongodb.
sudo start mongodb
or
sudo service mongodb start
Step 4: Check status of mongodb.
sudo status mongodb
or
sudo service mongodb status
Step 5: Start mongo console.
mongo
发布于 2013-06-21 02:08:51
在运行mongo
之前,您运行过mongod
吗?
我遵循了http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/的mongodb安装说明,只有在使用mongod
实际运行mongo进程之前运行mongo
时,我才遇到了与您相同的错误。我以为安装mongodb也能启动它,但在做其他需要mongodb的事情之前,你需要用mongod
手动启动它。
https://stackoverflow.com/questions/12831939
复制相似问题