Registry / database / redis-sentinel-client

redis-sentinel-client

JSON →
library0.2.5jsnpmunverified

A transparent Redis Sentinel client for Node.js that acts as a drop-in replacement for node_redis RedisClient. It automatically connects to Redis Sentinel, discovers the current master, and handles failover by reconnecting to the new master. The current stable version is 0.2.5. This package is unmaintained and depends on a specific fork of node_redis. It is suitable for legacy projects that need automatic Redis Sentinel failover without manual reconnection logic.

npm install redis-sentinel-client
INSTALL
IMPORT
SIG · REDIS-SENTINEL-CLI
R
redis-sentinel-client
databasejavascriptv0.2.5
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.

RedisSentinel
✓ const RedisSentinel = require('redis-sentinel-client');
✗ import RedisSentinel from 'redis-sentinel-client';
This package uses CommonJS (require). There is no ESM default import.
createClient
✓ const sentinelClient = RedisSentinel.createClient(options);
✗ const sentinelClient = RedisSentinel.createClient(6379, 'localhost', options);
The createClient function accepts (port, host, options) but this is less common and may be confused with node_redis's createClient. Prefer the options object form.
sentinelClient
✓ sentinelClient.set('key', 'value');
✗ sentinelClient.send_command('SET', ['key', 'value']);
All Redis commands are proxied to the master client. send_command is available but not recommended.

Creates a sentinel client that connects to a list of sentinels and communicates with the Redis master, handles failover transparently, and performs a set/get operation.

const RedisSentinel = require('redis-sentinel-client'); const options = { sentinels: [ ['127.0.0.1', 26379], ['127.0.0.1', 26380] ], masterName: 'mymaster', masterOptions: { auth_pass: process.env.REDIS_PASSWORD || '' } }; const sentinelClient = RedisSentinel.createClient(options); sentinelClient.on('connect', () => { console.log('Connected to Redis master via sentinel'); }); sentinelClient.on('error', (err) => { console.error('Redis error:', err); }); sentinelClient.set('testkey', 'Hello Sentinel', (err, reply) => { if (err) { console.error('Set error:', err); } else { console.log('Set succeeded:', reply); sentinelClient.get('testkey', (err, value) => { console.log('Got value:', value); sentinelClient.quit(); }); } });
Debug
Known issues
deprecatedThis package depends on a specific fork of node_redis (DocuSignDev/node-redis). That fork is no longer maintained, and the package has not been updated to work with the official redis npm package v3+.
fix
Use a more modern alternative like ioredis which has built-in Sentinel support (new Redis({sentinels: [...], name: 'mymaster'})) or redis npm package v4+ with Sentinel support.
affects: *
gotchaThe sentinel client emits a 'switch-master' event when a failover occurs, but the client does not automatically reconnect using authentication credentials if master_auth_pass is not set. Data loss can occur during failover.
fix
Always set master_auth_pass if your Redis master requires authentication. Monitor 'switch-master' event to re-establish connections if needed.
affects: *
gotchaThe package only supports a single master (with optional authentication). It does not support Redis Cluster or multiple masters.
fix
Use ioredis for cluster support or manage multiple sentinel clients manually.
affects: *
deprecatedThe node_redis package (and its fork) are considered legacy. The official redis npm package has rewritten the client (v4+), and redis-sentinel-client does not work with it.
fix
Migrate to redis npm package v4+ with its Sentinel support (require('redis').createClient({ url: 'redis://user:pass@host:port' })) or ioredis.
affects: >=4.0.0
Errors
Common errors & fixes
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
The sentinel client could not connect to the master because the master is down or the sentinel list is incorrect.
fix
Verify sentinel is running and monitoring the correct master name. Check masterOptions for correct host/port.
Error: NOAUTH Authentication required.
Master requires authentication but master_auth_pass was not provided in options.
fix
Add master_auth_pass: 'yourpassword' to the options object.
TypeError: RedisSentinel.createClient is not a function
Usually caused by incorrect require path or importing as ES module when the package uses CommonJS.
fix
Ensure you are using require('redis-sentinel-client') and the module is installed.
Upgrade
Version history
0.2.5latest on npm
Audit
Dependencies
redisrequiredDepends on a specific fork of node_redis (DocuSignDev fork) which has been modified for Sentinel support.
Agent activity
11 hits · last 30 days
node
10
Resources
redis-sentinel-client — npm install redis-sentinel-client · libregistry