Registry / database / redis-sentinel

redis-sentinel

JSON →
library0.3.3jsnpmunverified

Wrapper around node_redis that creates a Redis client pointing to the master server in a Sentinel-managed setup, with automatic failover when the master goes down. Version 0.3.3 is the latest, with no active releases since 2013. It differs from alternatives like ioredis in that it only supports basic failover and does not handle sentinel reconnection or advanced configurations. The library is deprecated; users should migrate to ioredis or redis with native sentinel support.

npm install redis-sentinel
INSTALL
IMPORT
SIG · REDIS-SENTINEL
R
redis-sentinel
databasejavascriptv0.3.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const sentinel = require('redis-sentinel');
import sentinel from 'redis-sentinel';
CommonJS only; no ESM support.
Sentinel
const Sentinel = require('redis-sentinel').Sentinel;
import { Sentinel } from 'redis-sentinel';
Factory function, not a class. Must require it.
createClient
const client = require('redis-sentinel').createClient(endpoints, masterName, opts);
const client = require('redis-sentinel').createClient({ endpoints, masterName });
Arguments are positional, not a single options object.

Creates a Redis client managed by Sentinel, demonstrating basic set and get operations with automatic failover.

const sentinel = require('redis-sentinel'); const endpoints = [ { host: '127.0.0.1', port: 26379 }, { host: '127.0.0.1', port: 26380 } ]; const opts = { retry_max_delay: 5000 }; const masterName = 'mymaster'; const client = sentinel.createClient(endpoints, masterName, opts); client.set('key', 'value', (err, reply) => { if (err) console.error(err); else console.log('Set:', reply); }); client.get('key', (err, value) => { if (err) console.error(err); else console.log('Got:', value); });
Debug
Known issues
deprecatedLibrary is deprecated; no active maintenance. Use ioredis or redis@4+ with native sentinel support.
fix
Replace with ioredis or redis@4.
affects: >=0.1.0
gotchaThe library does not handle sentinel reconnection; if all sentinels go down, the client will not recover.
fix
Implement custom sentinel reconnection logic or use a more robust client.
affects: all
gotchaThe masterName defaults to 'mymaster' if not provided; this may conflict with actual sentinel configurations.
fix
Always explicitly pass the masterName.
affects: all
breakingRequires node_redis (redis package) version 0.x; incompatible with redis@2.x and later.
fix
Install redis@0.12.1 or migrate to another library.
affects: all
gotchaThe Sentinel factory function must be called with endpoints before creating clients; it's not a constructor.
fix
Use const Sentinel = require('redis-sentinel').Sentinel(endpoints); then Sentinel.createClient().
affects: all
Errors
Common errors & fixes
ERR invalid password
Library does not support authentication (AUTH) in sentinel mode.
fix
Use a different client that supports sentinel auth (e.g., ioredis).
Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
All sentinels return no master or are unreachable; client fails to connect.
fix
Check sentinel endpoints and masterName; ensure at least one sentinel is reachable and has a master.
TypeError: Cannot read property 'createClient' of undefined
Incorrect import or require path; or missing redis dependency.
fix
Ensure 'redis' and 'redis-sentinel' are installed: npm install redis@0.12.1 redis-sentinel.
Upgrade
Version history
0.3.3latest on npm
Audit
Dependencies
redisrequiredpeer dependency; the library wraps node_redis (redis npm package).
Agent activity
16 hits · last 30 days
node
12
Amazon
2
Meta
1
Resources
redis-sentinel — npm install redis-sentinel · libregistry