Cliff Chaney
Cliff Chaney

Reputation: 414

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. I'd appreciate any help possible.

Following the directions referenced above, I appear to be able to get mongo running fine. (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. 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*

Upvotes: 0

Views: 1502

Answers (1)

Nikolai Onken
Nikolai Onken

Reputation: 91

You can access the shell prompt by simply running

$ mongo

Without the --host argument.

Upvotes: 1

Related Questions