简体   繁体   English

Mongo Shell无法连接到服务器

[英]Mongo shell can't connect to server

This must be a simple problem, but I've very carefully followed the excellent and simple documentation provided at https://docs.c9.io/setting_up_mongodb.html and read EVERY cloud9-ide tagged question that includes 'MongoDb' - to no avail. 这肯定是一个简单的问题,但是我非常仔细地遵循了https://docs.c9.io/setting_up_mongodb.html提供的出色而简单的文档,并阅读了包含“ MongoDb”的每个cloud9标记的问题-否无济于事。 I'd appreciate any help possible. 我将不胜感激。

Following the directions referenced above, I appear to be able to get mongo running fine. 按照上述参考说明,我似乎能够使mongo运行正常。 (See below.) (见下文。)

However, when I try the shell - as instructed - I get the following error: 但是,当我按照说明尝试外壳程序时,出现以下错误:

cliffchaney@sacs:~/workspace $ mongo --host $IP
MongoDB shell version: 2.6.4
connecting to: 0.0.0.0:27017/test
2014-09-10T17:53:55.570+0000 Error: couldn't connect to server 0.0.0.0:27017 (0.0.0.0), address resolved to 0.0.0.0 at src/mongo/shell/mongo.js:148
exception: connect failed

Any suggestions? 有什么建议么?

As noted, it appears that I can get mongod running. 如前所述,看来我可以让mongod运行。 After following the previously mentioned instructions, I can execute the following (though I do get a warning): 在遵循了前面提到的说明之后,我可以执行以下操作(尽管确实会收到警告):

cliffchaney@sacs:~/workspace $ ./mongod
2014-09-10T17:52:29.370+0000 ** WARNING: --rest is specified without --httpinterface,
2014-09-10T17:52:29.370+0000 **          enabling http interface
warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
2014-09-10T17:52:29.376+0000 [initandlisten] MongoDB starting : pid=1345 port=27017 dbpath=data 64-bit host=cliffchaney-sacs-983224
2014-09-10T17:52:29.376+0000 [initandlisten] db version v2.6.4
2014-09-10T17:52:29.376+0000 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-10T17:52:29.376+0000 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-09-10T17:52:29.376+0000 [initandlisten] allocator: tcmalloc
2014-09-10T17:52:29.376+0000 [initandlisten] options: { net: { bindIp: "0.0.0.0", http: { RESTInterfaceEnabled: true, enabled: true } }, storage: { dbPath: "data", journal: { enabled: false } } }
2014-09-10T17:52:29.389+0000 [initandlisten] waiting for connections on port 27017
2014-09-10T17:52:29.389+0000 [websvr] admin web console waiting for connections on port 28017
2014-09-10T17:53:29.389+0000 [clientcursormon] mem (MB) res:51 virt:238
2014-09-10T17:53:29.389+0000 [clientcursormon]  mapped:80
2014-09-10T17:53:29.389+0000 [clientcursormon]  connections:0
2014-09-10T17:58:29.399+0000 [clientcursormon] mem (MB) res:52 virt:239
2014-09-10T17:58:29.399+0000 [clientcursormon]  mapped:80
2014-09-10T17:58:29.399+0000 [clientcursormon]  connections:0
2014-09-10T18:03:29.410+0000 [clientcursormon] mem (MB) res:52 virt:239
2014-09-10T18:03:29.410+0000 [clientcursormon]  mapped:80
2014-09-10T18:03:29.410+0000 [clientcursormon]  connections:0*

You can access the shell prompt by simply running 您可以通过简单地运行来访问shell提示

$ mongo

Without the --host argument. 没有--host参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM