我使用Homebrew更新了MongoDB,但现在我再也无法启动它了。
控制台:
$ mongo
MongoDB shell version: 2.4.8
connecting to: test
Tue Dec 10 09:51:57.364 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
守护程序:
$ mongod
error command line: unrecognized line in '/usr/local/bin/mongod'
use --help for help
这是/usr/local/bin/mongod
:
#!/usr/bin/env ruby
ARGV << '--config' << '/usr/local/etc/mongod.conf' unless ARGV.find { |arg|
arg =~ /^ *--config$/ or arg =~ /^ *-f$/
}
exec "/usr/local/Cellar/mongodb/2.4.8/mongod", *ARGV
这是/usr/local/etc/mongod.conf
:
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
/usr/local/bin/mongod
# Only accept local connections
bind_ip = 127.0.0.1
数据文件夹存在:
$ ls /usr/local/var/mongodb
journal mongod.lock
我不知道如何解决这个问题。任何帮助都非常感谢。
答案 0 :(得分:1)
你的mongod.conf中似乎有一个额外的行,它只有db path目录。删除它并重试。