node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



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 = require('redis-watchtower');

Connect to Redis Sentinel, passing in details of your sentinel servers:

var settings = {
    masterName: 'mastername',
    sentinels: [{
        host: '',
        port: 26379
watchtower.connect(settings, function(err) {
    if(err) {
    } else {
        console.log('Connected to Sentinel');

You may now create redis clients, and use them as normal:

var client = watchtower.createClient();
client.get('key1', function(err, data) {
    console.log('key1: ' + data);

Client objects are standard Redis clients, with the added benefit that if the master server is replaced, the client is updated as required.