Registry / database / redis-cluster

redis-cluster

JSON →
library0.0.8jsnpmunverified

A thin wrapper over node_redis to handle Redis Clusters, currently at version 0.0.8. This library provides both a cluster client that auto-discovers cluster nodes via a seed link and a 'poor man's' cluster client for manually configured cluster topologies. It implements key-based command routing using CRC16 hashing to determine the correct shard. The package is designed for early Redis Cluster adopters and includes support for PUB/SUB. Key differentiators include minimal overhead, dependency on the widely-used node_redis, and support for custom slot assignments. However, the project appears to be in early development and is not actively maintained.

npm install redis-cluster
INSTALL
IMPORT
SIG · REDIS-CLUSTER
R
redis-cluster
databasejavascriptv0.0.8
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.

clusterClient
import { clusterClient } from 'redis-cluster';
const RedisCluster = require('redis-cluster');
The package exports two named objects: clusterClient and poorMansClusterClient. Use named import in ESM environments. CommonJS requires required path.
clusterInstance
new clusterClient.clusterInstance(link, callback)
const cluster = new clusterClient();
clusterClient is an object with a constructor function clusterInstance. Do not instantiate clusterClient directly.
poorMansClusterClient
import { poorMansClusterClient } from 'redis-cluster';
This is a function, not a class. Accepts an array of node descriptors with slots.

Creates a Redis cluster client from a seed node, sets and gets a key.

import { clusterClient } from 'redis-cluster'; const firstLink = '127.0.0.1:6379'; new clusterClient.clusterInstance(firstLink, (err, r) => { if (err) throw err; r.set('foo', 'bar', (err, reply) => { if (err) throw err; console.log('SET reply:', reply); r.get('foo', (err, val) => { if (err) throw err; console.log('GET:', val); }); }); });
Debug
Known issues
abandonedThis package is not actively maintained; use at your own risk. Consider using ioredis or redis (v4+) with cluster support instead.
fix
Migrate to a supported Redis client like ioredis or redis (v4+).
affects: all
deprecatedDepends on the 'redis' package (node_redis), which has undergone breaking changes in version 4. This package may not be compatible with newer versions of the 'redis' package.
fix
Pin the 'redis' dependency to a compatible version (e.g., 2.x or 3.x).
affects: *
gotchaCommands that operate on multiple keys across different slots (e.g., KEYS, MGET, MSET, transactions, Lua scripts) may not work correctly. Only single-key commands are recommended.
fix
Use only single-key commands. For multi-key operations, ensure all keys hash to the same slot or use hash tags.
affects: all
gotchaThe poor man's cluster client requires all slots to be covered exactly from 0 to 16383. If slots overlap or are missing, keys may be routed incorrectly.
fix
When defining node slots, ensure they are contiguous and cover the entire slot range without gaps or overlaps.
affects: all
Errors
Common errors & fixes
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server is not running or unreachable on the specified host and port.
fix
Ensure Redis cluster nodes are running and accessible. Use redis-cli to verify connectivity.
TypeError: clusterClient.clusterInstance is not a constructor
Attempting to instantiate clusterClient directly or using incorrect import.
fix
Use `new clusterClient.clusterInstance(link, callback)` — clusterClient is an object containing the constructor function.
ERR Slot 12345 not covered by any node
The poor man's cluster client does not have a node covering the computed slot for the key.
fix
Check that all 16384 slots are assigned to nodes in the cluster configuration.
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies
redisrequiredCore dependency for connection to individual Redis nodes; uses node_redis (now called redis) as the underlying driver.
Agent activity
38 hits · last 30 days
node
34
Meta
1
Resources
redis-cluster — npm install redis-cluster · libregistry