【发布时间】:2015-08-26 20:59:18
【问题描述】:
我的电脑上安装了 debian 操作系统。
Distributor ID: Debian
Description: Debian GNU/Linux 8.1 (jessie)
Release: 8.1
Codename: jessie
我已按照此教程在我的计算机上Install MongoDB on Debian 安装 mongo db。
MongoDB版本:
mongo --version
MongoDB shell version: 2.6.9
现在当我在终端运行mongo 命令时,它会说
mongo
MongoDB shell version: 2.6.9
connecting to: test
2015-08-08T06:29:50.480-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-08-08T06:29:50.481-0500 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
并运行此命令显示以下错误
sudo service mongodb restart
Failed to restart mongodb.service: Unit mongodb.service failed to load: No such file or directory.
关于为什么会发生这种情况以及如何解决它的任何想法?
【问题讨论】:
-
mongod守护进程显然没有运行。检查您的服务配置。它被称为mongodb(它似乎不是)或mongod。然后检查服务脚本中引用的配置文件以获取数据和日志的位置,以查看出现的任何错误。
标签: mongodb debian mongo-shell