linux - 无法在ubuntu中启动mongo shell

标签 linux mongodb shell ubuntu

我是 Mongo 的新手。我已经在我的 ubuntu 桌面上安装了 mongo DB 并使用以下命令启动 mongod 服务 -

sudo service mongod start
root@monti-ThinkPad-L440:/home/monti# sudo service mongod start
root@monti-ThinkPad-L440:/home/monti# sudo service mongod status
● mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-06-10 19:19:04 IST; 19s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 4407 (mongod)
   CGroup: /system.slice/mongod.service
           └─4407 /usr/bin/mongod --quiet --config /etc/mongod.conf

Jun 10 19:19:04 monti-ThinkPad-L440 systemd[1]: Started High-performance, schema-free document-oriented database.

但是当我启动 mongo shell 时,我遇到了以下错误:

root@monti-ThinkPad-L440:/home/monti# mongo
MongoDB shell version: 3.2.13
connecting to: test
2017-06-10T19:20:44.363+0530 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-06-10T19:20:44.363+0530 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed

非常感谢任何帮助!!!!谢谢!!!

最佳答案

这里有很多关于这个问题的好答案:
Connection refused to MongoDB errno 111

其中一个肯定会解决您的问题。
通常是由于/etc/mongod.conf 中的某些错误配置或/var/lib/mongodb/mongod.lock 中的锁定

希望对您有所帮助!

关于linux - 无法在ubuntu中启动mongo shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44474086/

相关文章:

c - C语言中fgets函数的使用

git - 获取 Git 中两次提交之间修改次数最多的文件

linux - 使用 iconv 将 UTF-16LE 转换为 UTF-8

mongodb - 与 Mongos 连接时 system.profile 集合中缺少用户字段

node.js - Model.find({_id :req. body.id}) 找到该对象,但 Model.updateOne({_id :req. body.id},{//update}) 未找到该对象

javascript - 无法读取未定义的属性 'push'

Linux Shell 脚本 - 如何获取参数 $n 的上层目录

linux -/usr/local/lib 的 OS X 权限被拒绝

c++ - 如何确定 Linux 上的当前 CPU 使用率,最好使用 C++?

linux - 获取 "-("和 ")-"之间的字符串,linux 目录