Can't connect Mongo

1,393 views
Skip to first unread message

Gary Zhao

unread,
Jan 31, 2014, 10:56:53 PM1/31/14
to mongod...@googlegroups.com
Hello

I'm seeing the below error intermittently. Anyone has any ideas why it happened and any workaround?


From mongoshell:

$ mongo
MongoDB shell version: 2.4.8
connecting to: test
Sat Feb  1 03:22:00.066 DBClientCursor::init call() failed
Sat Feb  1 03:22:00.067 Error: DBClientBase::findN: transport error: 127.0.0.1:27017 ns: admin.$cmd query: { whatsmyuri: 1 } at src/mongo/shell/mongo.js:145
exception: connect failed

From mongo node client:

Error: No primary found in set
    at /var/groupon/www/deal-service-api/releases/20140201035334/node_modules/mongodb/lib/mongodb/mongo_client.js:375:11
    at /var/groupon/www/deal-service-api/releases/20140201035334/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31
    at process._tickCallback (node.js:415:13)

Thanks
Gary

Stephen Steneker

unread,
Jan 31, 2014, 11:56:43 PM1/31/14
to mongod...@googlegroups.com
Hi Gary,

Both errors suggest that the MongoDB server is either not running or not accepting new connections.  Since you mention only seeing this problem intermittently, I expect the latter case is more likely.

I would suggest checking the number of connections you have currently open and available via:
db.serverStatus().connections

If you have a low number of available connections, you may need to increase the ulimit settings or look at how your app is using connections:

Regards,
Stephen

Gary Zhao

unread,
Feb 1, 2014, 12:17:36 PM2/1/14
to mongod...@googlegroups.com
Hi Stephen

You are right. I just noticed it. Looks there are very few connections available. Do you know how to check who's connecting? The current number looks surprising to me. I wasn't aware there are so many clients connected.

{ "current" : 816, "available" : 3, "totalCreated" : NumberLong(1269341) }

Thanks
Gary
Reply all
Reply to author
Forward
0 new messages