Error :couldn't connect to server 127.0.0.1:27017 MongoDB
Error :couldn't connect to server 127.0.0.1:27017 MongoDB
服务器启动时出现问题mongodb
user@-VirtualBox:~$ mongo
MongoDB shell version: 2.4.9
connecting to: test Sun May 8 22:10:13.641 Error: couldn't connect to
server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception:
connect failed
如何解决这个问题?
我遇到了同样的问题。查看位于 /var/log/mongodb/mongodb.log
的 MongoDB 日志文件,解释了原因 - 在我的例子中是:
ERROR: Insufficient free space for journal files
Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles
您的端口似乎已被使用,请尝试更改 27017 以外的端口号。
然后首先使用 'mongod' 命令开始,该命令在 运行 'mongo' 之后将 运行ning 保留在后台。
这个对我有用 mac
Find "usr/local/etc" dir
In "etc" folder find "mongod.conf"
In the file I had to set the bindIp configuration item to 0.0.0.0, i changed port to 27020
# network interfaces
net:
port: 27020
bindIp: 0.0.0.0
运行 以下:
mongod --config /usr/local/etc/mongod.conf
然后 运行 然后在终端中打开新标签:
> mongo --port 27020
希望这对你有用。
服务器启动时出现问题mongodb
user@-VirtualBox:~$ mongo MongoDB shell version: 2.4.9 connecting to: test Sun May 8 22:10:13.641 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception: connect failed
如何解决这个问题?
我遇到了同样的问题。查看位于 /var/log/mongodb/mongodb.log
的 MongoDB 日志文件,解释了原因 - 在我的例子中是:
ERROR: Insufficient free space for journal files
Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles
您的端口似乎已被使用,请尝试更改 27017 以外的端口号。 然后首先使用 'mongod' 命令开始,该命令在 运行 'mongo' 之后将 运行ning 保留在后台。 这个对我有用 mac
Find "usr/local/etc" dir In "etc" folder find "mongod.conf" In the file I had to set the bindIp configuration item to 0.0.0.0, i changed port to 27020
# network interfaces
net:
port: 27020
bindIp: 0.0.0.0
运行 以下:
mongod --config /usr/local/etc/mongod.conf
然后 运行 然后在终端中打开新标签:
> mongo --port 27020
希望这对你有用。