我已經通過以下鏈接安裝了redis。 https://github.com/mranney/node_redis使用redis發出錯誤
,並試圖
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();
});
和運行node test.js
給了我這個錯誤,爲什麼?
Error Error: Redis connection to 127.0.0.1:6379 failed - ECONNREFUSED, Connection refused
爲什麼這個錯誤即將到來?我該怎麼辦?
確定Redis的服務器正在運行時, nd你沒有設置密碼? – Colum 2011-05-31 11:01:45
@colum是問題是由於redis服務器不啓動,請更新回答 – XMen 2011-05-31 11:52:43