A client library for Redis Sentinel
A node.js client library for Redis Sentinel
npm install redis-watchtower
Redis-Watchtower is dependant upon node_redis. In order to use Redis-Watchtower, however, you will need to make a slight modification to node_redis.
Because Redis Sentinel is still on the unstable branch, the sentinel redis command is not included in node_redis, thankfully, it is very easy to eanble this command.
To enable the sentinel command in node_redis, simply open up index.js in the node_redis module, navigate to the command which assigns redis commands to the 'commands' variable (around line number 888) and add "sentinel" to the list. Alternitively, add "sentinel" to the list in the file 'lib/commands.js' in node_redis.
First of all reference redis-watchtower as follows:
var watchtower = ;
Connect to Redis Sentinel, passing in details of your sentinel servers:
var settings =masterName: 'mastername'sentinels:host: '127.0.0.1'port: 26379;watchtower;
You may now create redis clients, and use them as normal:
var client = watchtower;client;
Client objects are standard Redis clients, with the added benefit that if the master server is replaced, the client is updated as required.