Advertisement
Intermediate Redis, Connection Pooling & Client Libraries

What is the difference between a cluster aware client and a regular client when connecting to a Redis Cluster?

Short answer

A cluster aware client understands the cluster's hash slot mapping and automatically routes each command directly to the correct node responsible for that key, while a regular client would need to manually handle MOVED and ASK redirects itself, making a cluster aware client…

Save Redis mock interview
Advertisement
AModel answer
A cluster aware client understands the cluster's hash slot mapping and automatically routes each command directly to the correct node responsible for that key, while a regular client would need to manually handle MOVED and ASK redirects itself, making a cluster aware client essential for building an application that works correctly and efficiently against a Redis Cluster.
// A cluster aware client automatically routes commands
const Redis = require('ioredis');
const cluster = new Redis.Cluster([{ host: 'node1', port: 6379 }]);
Real-world example
A development team switches from a regular Redis client to a cluster aware one when migrating their application to Redis Cluster, avoiding the need to manually implement redirect handling logic themselves.
Likely follow-ups
  • What happens if you try to use a non cluster aware client against a Redis Cluster?
  • How does a cluster aware client discover the current slot mapping?
Related topics