node.js - socket.io redis store on openshift -
i'm trying set socket.io on node.js use redisstore can comunicate pubsub multiple node on opeshift platform, can't manage connect redis server. i'm using this cartridge. tried connect with
var pub = redis.createclient(process.env.openshift_redis_db_port, process.env.openshift_redis_db_host);
but doesn't work (and found out why: createclient() accept ip addresses) , fallback default port , host, ran rhc port-forward:
$ rhc port-forward appname checking available ports ... done forwarding ports ... address in use - bind(2) while forwarding port 8080. trying local port 8081 connect service running on openshift, use local address service local openshift --------------- --------------- ---- ---------------------------------------------- haproxy 127.0.0.1:8080 => 127.5.149.130:8080 haproxy 127.0.0.1:8081 => 127.5.149.131:8080 s_redis_db_host 127.0.0.1:54151 => blabla.appname.rhcloud.com:54151 press ctrl-c terminate port forwarding
so tought doing wrong , had set port this:
var pub = redis.createclient(process.env.openshift_redis_db_port);
but this
info: socket.io started events.js:72 throw er; // unhandled 'error' event ^ error: redis connection 127.0.0.1:54151 failed - connect econnrefused @ redisclient.on_error (/var/lib/openshift/532c3790e0b8cd9bb000006b/app-root/runtime/repo/node_modules/socket.io/node_modules/redis/index.js:149:24) @ socket.<anonymous> (/var/lib/openshift/532c3790e0b8cd9bb000006b/app-root/runtime/repo/node_modules/socket.io/node_modules/redis/index.js:83:14) @ socket.eventemitter.emit (events.js:95:17) @ net.js:426:14 @ process._tickcallback (node.js:415:13) debug: program node server.js exited code 8
i tried connect via
telnet $openshift_redis_db_host $openshift_redis_db_port
and works fine... have suggestions? doing wrong? (i'm still new redis , socket.io) (i omitted rest of code 'cause know works, have no problem on local machine, can't connection...) lot
but doesn't work (and found out why: createclient() accept ip addresses) , fallback default port , host
it support host, createclient uses net.createconnection(port, host);
support hostname.
the following code find issue:
console.log(process.env); var pub = redis.createclient(process.env.openshift_redis_db_port, process.env.openshift_redis_db_host, {auth_pass: process.env.openshift_redis_db_password}); pub.on('error', console.log.bind(console)); pub.on('ready', console.log.bind(console, 'redis ready'));
does openshift redis instance requires auth
?
Comments
Post a Comment