Registry / database / redis-clustr

redis-clustr

JSON →
library1.7.0jsnpmunverified

redis-clustr (v1.7.0) is a thin wrapper around the node_redis client for Redis Cluster support. It auto-discovers nodes via CLUSTER SLOTS, handles MOVED/ASK redirections, and supports pub/sub, multi-key commands (del/mget/mset), and batch operations. The library is no longer actively maintained; users should migrate to ioredis which has native cluster support.

npm install redis-clustr
INSTALL
IMPORT
SIG · REDIS-CLUSTR
R
redis-clustr
databasejavascriptv1.7.0
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.

RedisClustr
import RedisClustr from 'redis-clustr'
const RedisClustr = require('redis-clustr').RedisClustr
Default export in CJS, named import for TypeScript is also supported

Creates a RedisCluster client with one server, sets and gets a key.

const RedisClustr = require('redis-clustr'); const redis = new RedisClustr({ servers: [ { host: process.env.REDIS_HOST ?? '127.0.0.1', port: parseInt(process.env.REDIS_PORT ?? '7000', 10) } ] }); redis.set('key', 'value', (err, reply) => { if (err) console.error(err); else console.log('Set key:', reply); }); redis.get('key', (err, value) => { if (err) console.error(err); else console.log('Got value:', value); });
Debug
Known issues
deprecatedredis-clustr is no longer actively maintained. Consider using ioredis for native Redis cluster support.
fix
Replace with ioredis: npm install ioredis; use new Redis.Cluster([{host, port}])
affects: >=1.0.0
breakingMulti/exec commands are not atomic; they are treated as batched individual commands.
fix
Use pipeline or batch pattern, or migrate to a library that supports atomic multi.
affects: >=1.0.0
gotchaThe 'slaves' option defaults to 'never', meaning read-only commands go to masters only. If set to 'share' or 'always', ensure slaves are available and you can handle stale data.
fix
Set slaves option explicitly to match your use case: 'never', 'share', or 'always'.
affects: >=1.0.0
breakingSlot reallocation may cause commands to be re-issued on different nodes, potentially leading to out-of-order execution.
fix
Use redis cluster with appropriate slot hashing and ensure idempotent commands.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
No Redis server running at the specified host/port.
fix
Start a Redis server or check the server configuration in the options.
MOVED 1234 192.168.1.2:6380
Redis cluster redirects the command to a different node.
fix
This is normal; redis-clustr automatically redirects. If you see it logged, ensure the library is handling it.
ASK 1234 192.168.1.2:6380
Redis cluster asks for redirection during slot migration.
fix
redis-clustr should handle ASK redirections automatically; if not, check your library version.
Upgrade
Version history
1.7.0latest on npm
Audit
Dependencies
redisrequiredUses node_redis as the underlying Redis client
Agent activity
7 hits · last 30 days
node
6
Resources
redis-clustr — npm install redis-clustr · libregistry