-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Description
We want to add support for more redis connection types like Redis Cluster is one example to improve scalability and high availability. This will allow us to:
- Horizontally scale Redis across multiple nodes
- Enable automatic sharding
- Support data partitioning across nodes
- Improve overall system reliability
Implementation Details
- Set up a 3-node Redis Cluster configuration
- Configure Redis client to support cluster mode
- Update application code to handle cluster operations
- Add documentation for cluster setup and management
Technical Requirements
- Redis version 7
- Cluster mode enabled on all nodes
- Client library with cluster support
Docker Configuration
Below is the docker-compose configuration for a 3-node Redis Cluster:
services:
redis-1:
image: redis:7
command: redis-server --port 7000 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000
ports:
- "7000:7000"
- "17000:17000"
networks:
- redis-net
redis-2:
image: redis:7
command: redis-server --port 7001 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000
ports:
- "7001:7001"
- "17001:17001"
networks:
- redis-net
redis-3:
image: redis:7
command: redis-server --port 7002 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000
ports:
- "7002:7002"
- "17002:17002"
networks:
- redis-net
networks:
redis-net:
Cluster Initialization Commands
# Initialize cluster
echo "yes" | docker exec -i data-redis-1-1 redis-cli --cluster create \
data-redis-1-1:7000 data-redis-2-1:7001 data-redis-3-1:7002 \
--cluster-replicas 0
# Verify cluster status
docker exec data-redis-1-1 redis-cli -p 7000 cluster info
docker exec data-redis-1-1 redis-cli -p 7000 cluster nodes
Client Configuration Example
redis = Redis::Cluster.new(
nodes: [
"redis://localhost:7000",
"redis://localhost:7001",
"redis://localhost:7002"
],
timeout: 5,
connect_timeout: 5
)
Acceptance Criteria
- Redis Cluster successfully deployed with Docker Compose
- Cluster initialization script works correctly
- Application can connect to and interact with the cluster
- Documentation updated with cluster setup instructions
- Tests added/updated to verify cluster functionality
Labels
- enhancement
- infrastructure
- redis
Metadata
Metadata
Assignees
Labels
No labels