4

I have installed redis by following links . https://github.com/mranney/node_redis

and trying

var redis = require("redis"),
    client = redis.createClient();

client.on("error", function (err) {
    console.log("Error " + err);
});

client.set("string key", "string val", redis.print);
client.hset("hash key", "hashtest 1", "some value", redis.print);
client.hset(["hash key", "hashtest 2", "some other value"], redis.print);
client.hkeys("hash key", function (err, replies) {
    console.log(replies.length + " replies:");
    replies.forEach(function (reply, i) {
        console.log("    " + i + ": " + reply);
    });
    client.quit();
});

and running node test.js

gives me this error why ?

Error Error: Redis connection to 127.0.0.1:6379 failed - ECONNREFUSED, Connection refused

why this error is coming ? and what should i do ?

2
  • Are you sure the Redis server is running, and you did not set a password on it? Commented May 31, 2011 at 11:01
  • @colum yeah problem was due to redis server not starte , please update in answer Commented May 31, 2011 at 11:52

2 Answers 2

6

You need to make sure the server is running before you can not access it in Node.Js

Sign up to request clarification or add additional context in comments.

Comments

0

It is worth noting that you first must install the redis server by running

sudo apt-get install redis-server

and then if it is not running you can start it by running

redis-server

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.