icflorescu/openshift-cartridge-mongodb

help!Couldn't connect to mongodb

Closed this issue · 3 comments

wmzy commented

mongodb.log

2015-07-04T12:00:44.901-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=7G,session_max=20000,eviction=(threads_max=4),statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2015-07-04T12:00:45.390-0400 I CONTROL  [initandlisten] MongoDB starting : pid=196522 port=27017 dbpath=/var/lib/openshift/557e86a4500446e106000178/app-root/data/.mongodb/data 64-bit host=ex-std-node631.prod.rhcloud.com
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] 
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] 
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] 
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 250 processes, 1024 files. Number of processes should be at least 512 : 0.5 times number of files.
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] 
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] db version v3.0.3
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] git version: b40106b36eecd1b4407eb1ad1af6bc60593c6105
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] build info: Linux build14.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
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] allocator: tcmalloc
2015-07-04T12:00:45.391-0400 I CONTROL  [initandlisten] options: { net: { bindIp: "127.5.252.2", unixDomainSocket: { enabled: false } }, storage: { dbPath: "/var/lib/openshift/557e86a4500446e106000178/app-root/data/.mongodb/data", engine: "wiredTiger" }, systemLog: { logAppend: true, logRotate: "reopen", quiet: true } }
2015-07-04T12:00:45.473-0400 I NETWORK  [initandlisten] waiting for connections on port 27017

nodejs.log

/var/lib/openshift/557e86a4500446e106000178/app-root/runtime/repo/node_modules/connect-mongo/node_modules/mongodb/lib/server.js:228
        process.nextTick(function() { throw err; })
                                            ^
Error: connect ECONNREFUSED
    at errnoException (net.js:901:11)
    at Object.afterConnect [as oncomplete] (net.js:892:19)

It would be helpful if you'd describe your setup and/or code a bit.
Are Node.js and MongoDB running in the same gear or in two distinct gears?
How does your connection string look like (i.e. are you adding a database name, like this: process.env.MONGODB_URL + 'database_name')?

wmzy commented

I checked my code and found the problem.
I updated the connect-mongo and its api has changed.
It was very careless of me.
Thank you for your reminding.

No problem, it can happen to anyone :-)