What I did:
Downloaded redis 2.0 source from google code to a folder just off my desktop called redis. unzip, untar, cd redis-2.0.0-rc4, make. Ran ./redis-server and let it sit - listening for connections. (this uses the standard config, nothing special. I did nothing but run it.)
Made a folder inside the Desktop/redis folder called node-redis-client. did a git clone for node-redis-client then get checkout redis-2.0 to get the branch that works with redis 2.0. This puts a lib folder there with a script called redis-client.js
A while ago I downloaded node.js to a folder just off my desktop called node. Not sure what I had to do to get it running. Probably not much. For this, I simply cd'ed into that folder and ran ./node. It worked.
In the node folder I wrote the following program, called it hello-node-redis.js, and ran ./node hello-node-redis.js, then hit http://127.0.0.1:8008 with firefox, hit reload a few times. it worked.
var sys = require("sys"),
http = require("http"),
client = require("../redis/redis-node-client/lib/redis-client").createClient();
http.createServer(function(request, response) {
client.get('mycounter', function(err, data){
var headers = { "Content-Type": "text/plain" };
response.writeHead(200, headers);
response.write("Hello, World!\n");
if( !data ){
response.write('does not exist');
sys.puts("mycounter does not exist");
return;
}
sys.puts("doing a responsewrite for mycounter");
response.write(data.toString());
response.end();
});
client.incr('mycounter',
function (err, reply) {
sys.puts("incr mycounter " +
(reply == 0? "no one" : (reply + ".")));
}
);
client.publish("channel-1", "ohhai",
function (err, reply) {
sys.puts("Published message to channel-1 " +
(reply == 0? "no one" : (reply + " subscriber(s).")));
});
}).listen(8008);
sys.puts("> Running at http://127.0.0.1:8008/");
special thanks to:
http://howtonode.org/node-redis-fun
http://www.pgrs.net/2010/2/28/node-js-redis-and-resque