Deploy Redis cluster in Kubernetes
Redis Cluster requires at least 3 master nodes, so we have 6 replicas here ( 3 master / 3 slave )
kubectl apply -f statefulset.yml
kubectl apply -f service.yml
You should scale the cluster up or down manually
kubectl get pods -l app=redis-cluster -o jsonpath='{range.items[*]}{.status.podIP}:6379 '
Now we are going to create the cluster ( assign master/slave roles, distribute slot maps) using the redis-cli --cluster create
script.
Since we are going create 3 masters cluster with 3 dedicated slaves, the --cluster-replicas 1
flag is passed.
kubectl exec -it redis-cluster-0 -- redis-cli --cluster create --cluster-replicas 1 <<< node list from previous command >>>
Or you can merge command like this :
kubectl exec -it redis-cluster-0 -- redis-cli --cluster create --cluster-replicas 1 $(kubectl get pods -l app=redis-cluster -o jsonpath='{range.items[*]}{.status.podIP}:6379 ')
- Fork it !
- Create your feature branch :
git checkout -b my-new-feature
- Commit your changes :
git commit -am 'Add some feature'
- Push to the branch :
git push origin my-new-feature
- Submit a pull request :D
Each project may have many problems. Contributing to the better development of this project by reporting them.