Skip to content

Latest commit

 

History

History

redis-cluster

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Redis Cluster

reference

Usage

kustomize build . | kubectl apply -f -

The default password is mypass123 for both master-slave replication and accessing cluster.

Join Redis Nodes

Join all nodes:

export REDIS_PASSWORD=mypass123
kubectl exec -it redis-cluster-0 -n infra -- redis-cli -a ${REDIS_PASSWORD} --cluster create --cluster-replicas 1 $(kubectl get pods -n infra -o jsonpath='{range.items[*]}{.status.podIP}:6379 ' | rev | cut -c 7- | rev)

Check the cluster info:

kubectl exec -it redis-cluster-0 -n infra -- redis-cli -a ${REDIS_PASSWORD} cluster info
for x in $(seq 0 5); do echo "redis-cluster-$x"; kubectl exec redis-cluster-$x -n infra -- redis-cli -a ${REDIS_PASSWORD} role; echo; done

Benchmark (should be executed on master node):

kubectl exec -it redis-cluster-0 -n infra -- redis-benchmark -a ${REDIS_PASSWORD} -h localhost -p 6379

Note