When attempting to connect to the mongodb-2.4 cartridge i keep getting the following
==> app-root/logs/nodejs.log <==
Error: connect ECONNREFUSED 127.0.0.1:27017
at Object.exports._errnoException (util.js:893:11)
at exports._exceptionWithHostPort (util.js:916:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1075:14)
I am creating the connection string as below
if(process.env.OPENSHIFT_MONGODB_DB_PASSWORD){
connection_string = process.env.OPENSHIFT_MONGODB_DB_USERNAME + ":" +
process.env.OPENSHIFT_MONGODB_DB_PASSWORD + "@" +
process.env.OPENSHIFT_MONGODB_DB_HOST + ':' +
process.env.OPENSHIFT_MONGODB_DB_PORT + '/' +
process.env.OPENSHIFT_APP_NAME;
}
It looks like when it fails it thinks the port is 27017 but when i run rhc port-forward appname it shows me the following different port for mongodb
Service Local OpenShift
------- --------------- ---- ------------------------------------------------------
haproxy 127.0.0.1:8080 => 127.6.174.2:8080
haproxy 127.0.0.1:8081 => 127.6.174.3:8080
mongodb 127.0.0.1:42346 => 5747fa8f70-appname.rhcloud.com:42346
node 127.0.0.1:8082 => 127.6.174.1:8080
Any ideas as to whats going wrong?