Connecting to redis with kue always creates a connection to localhost

I cannot connect to Redis using kue, I followed this article , practically I create a connection using kue redis client, and the connection code:

  var kue = require('kue'),
  redis = require('kue/node_modules/redis');

  app.redisClient =  redis.createClient('6379', 'remoteip',{});
  app.redisClient.on('error', function (err) {
      console.log('Redis error encountered', err);
  });

  app.redisClient.on('end', function() {
      console.log('Redis connection closed');
   });

   kue.redis.createClient = function() {
      console.log('client ------------------',app.redisClient);
      return app.redisClient;
   };

and it seems that Kue is trying to connect to the local Redis (which I did not install), because I get this exception:

Error: Redis connection with 127.0.0.1:6379 failed - connect ECONNREFUSED

I read this post and it looks like the problem was resolved in version 0.8 and I am using 0.8.11: /, finally I also wanted to override the client using a different client instance using redis nodejs with no luck because I get the same a mistake.

any help would be more than appreciated. thank!

+4
1

, , , :

app.redisClient =  redis.createClient(config.redisPort, config.redisUrl,{});

app.redisClient.on('connect', function () {
    console.info('successful connection to redis server');
});

app.redisClient.on('error', function (err) {
    console.log('Redis error encountered', err);
});

app.redisClient.on('end', function() {
    console.log('Redis connection closed');
});

kue.app.listen(config.kuePort);

app.jobs = kue.createQueue({
    redis: {
        createClientFactory: function(){
            return app.redisClient;
        }
    }
});
+1

All Articles