redis-operator

Redis Operator provides high availability redis with sentinel automatic failover on Kubernetes.

Redis Operator provides high availability redis with sentinel automatic failover on Kubernetes.

Redis-Operator

A redis-operator based on operator-sdk, it provides high availability redis with sentinel automatic failover on Kubernetes.

asciicast

GitHub: https://github.com/kube-incubator/redis-operator

How to use it

Deploy Redis-Operator

$ helm package .
$ helm install example redis-operator-1.0.0.tgz

Deploy sample redis cluster

$ kubectl apply -f https://raw.githubusercontent.com/kube-incubator/redis-operator/master/deploy/samples/basic.yaml
$ kubectl get pod
NAME                                       READY   STATUS    RESTARTS   AGE
bc-redis-example-0                         1/1     Running   0          2m15s
bc-redis-example-1                         1/1     Running   0          93s
bc-redis-example-2                         1/1     Running   0          58s
bc-sentinel-example-6587886489-72zmr       1/1     Running   0          2m16s
bc-sentinel-example-6587886489-d2nlb       1/1     Running   0          2m16s
bc-sentinel-example-6587886489-wmfs7       1/1     Running   0          2m16s
example-redis-operator-54bfbd6cdd-lvttx    1/1     Running   0          2m27s

Connect to the redis cluster

$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -p 26379 SENTINEL get-master-addr-by-name master
1) "172.17.0.8"
2) "6379"
$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -h 172.17.0.8 -p 6379 SET hello world!
OK
$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -h 172.17.0.8 -p 6379 GET hello
"world!"

Get Sentinel Service Endpoint

$ kubectl get svc -l sentinel=example
NAME                  TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)     AGE
bc-sentinel-example   ClusterIP   10.106.24.84   <none>        26379/TCP   2m16s
  • 安装

    Add repository

    helm repo add apphub https://apphub.aliyuncs.com/

    Install chart

    helm install apphub/redis-operator --version 1.0.0
    一键安装
  • Chart 版本

    1.0.0
  • App 版本

  • 主页