How to fix ERR SELECT is not allowed in cluster mode in Redis

RedisINTERMEDIATEMEDIUMUpdated Dec 29, 2025· 220 views

Redis Cluster mode only supports database 0 and disallows the SELECT command. This error occurs when your client attempts to switch databases in cluster mode, which is not supported by design.

Quick fix

Fixes ERR SELECT is not allowed in cluster mode

redis-cli -c info cluster
  1. Verify you are using Redis Cluster mode
  2. Remove database number from connection string
  3. Check your client library configuration
  4. Migrate data to database 0 if needed
redis — error
redis-cli -c info cluster
ERR SELECT is not allowed in cluster mode

What this error means

Redis Cluster is a distributed version of Redis that shards data across multiple nodes. Unlike standalone Redis, which supports 16 separate databases (0-15) that you can switch between using the SELECT command, Redis Cluster deliberately restricts you to database 0 only. When running in cluster mode, the SELECT command is explicitly rejected to maintain architectural consistency and prevent the complexity of cross-database operations in a distributed system. This limitation is intentional—not a bug—and ensures that atomic operations remain possible without having to coordinate across multiple databases.

Typical symptoms

  • Application crashes or connection errors when connecting to AWS ElastiCache Redis Cluster
  • Redis client library throws "ReplyError: ERR SELECT is not allowed in cluster mode"
  • Sidekiq or other job queue frameworks fail when configured for cluster mode
  • Redis connection string contains a database number (e.g., redis://host:port/12) but cluster mode is enabled
  • Works in local development but fails in production with clustered Redis

Common causes

  1. Your application or Redis client is configured with a database number (e.g., SELECT 1, SELECT 5) when connecting to a Redis Cluster
  2. Client library defaults assume standalone Redis and attempt to select non-zero databases
  3. AWS ElastiCache is set to Cluster Mode Enabled (CME) or Serverless, which does not support multiple databases
  4. Migration from standalone Redis to cluster mode without updating application configuration
  5. Redis connection URL includes a database number suffix that is incompatible with cluster mode

How to fix "ERR SELECT is not allowed in cluster mode"

1Verify you are using Redis Cluster mode

First, confirm that your Redis instance is actually running in cluster mode:

bash
redis-cli -c info cluster

Look for cluster_enabled: 1 in the output. If it shows 0, you are in standalone mode and can use SELECT.

2Remove database number from connection string

Update your Redis connection configuration to remove any database number. Change from:

bash
redis://host:6379/5
redis://host:6379/12

To:

bash
redis://host:6379

Also remove any db, database, or select parameters from your client configuration.

3Check your client library configuration

If using a specific Redis client library, verify it is configured for cluster mode:

For ioredis (Node.js):

javascript
const redis = new Redis.Cluster([
  { host: 'host1', port: 6379 },
  { host: 'host2', port: 6379 }
]);

For Predis (PHP):

php
$client = new Client('redis://host:6379');

For redis-py (Python):

python
from rediscluster import RedisCluster
rc = RedisCluster(startup_nodes=[{"host": "host", "port": "6379"}])
4Migrate data to database 0 if needed

If you currently store data in multiple databases and are migrating to cluster mode, consolidate all data into database 0. Use the MOVE command to move keys:

bash
# Connect to standalone Redis
redis-cli -n 1  # Select database 1
MOVE key_name 0  # Move to database 0

Or use MIGRATE for remote migration:

bash
MIGRATE host port key 0 timeout
5If you need multiple databases, use non-clustered Redis

If your application architecture requires multiple separate databases, you have two options:

Option 1: Use standalone (non-cluster) Redis
- Set cluster mode to disabled in your Redis configuration
- In AWS ElastiCache, create a new cluster with "Cluster Mode Disabled"
- This allows you to use SELECT and multiple databases

Option 2: Use Redis with Cluster Mode Disabled

bash
# In redis.conf
cluster-enabled no

Advanced notes

Redis Cluster is designed for horizontal scalability and high availability across multiple nodes. Supporting multiple databases in cluster mode would require coordinating state across nodes and make transactions significantly more complex. Therefore, this limitation is architectural, not accidental. If you are using AWS ElastiCache Serverless, it exclusively uses Cluster Mode Enabled and cannot be changed—you must redesign your application to use a single database (db0). For very large deployments, consider using Redis Streams or Hash-based key namespacing instead of database separation.

Frequently asked questions

What does "ERR SELECT is not allowed in cluster mode" mean?
Redis Cluster is a distributed version of Redis that shards data across multiple nodes. Unlike standalone Redis, which supports 16 separate databases (0-15) that you can switch between using the SELECT command, Redis Cluster deliberately restricts you to database 0 only. When running in cluster mode, the SELECT command is explicitly rejected to maintain architectural consistency and prevent the complexity of cross-database operations in a distributed system.
How do I fix "ERR SELECT is not allowed in cluster mode"?
Redis Cluster mode only supports database 0 and disallows the SELECT command. This error occurs when your client attempts to switch databases in cluster mode, which is not supported by design.
What causes "ERR SELECT is not allowed in cluster mode"?
Your application or Redis client is configured with a database number (e.g., SELECT 1, SELECT 5) when connecting to a Redis Cluster Client library defaults assume standalone Redis and attempt to select non-zero databases AWS ElastiCache is set to Cluster Mode Enabled (CME) or Serverless, which does not support multiple databases
Is the "ERR SELECT is not allowed in cluster mode" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading