本文采用Operator来快速部署redis-cluster集群
Operator官方模板地址:
[https://github.com/operator-framework/awesome-operators] :
redis-cluster官方部署地址:
[https://github.com/ucloud/redis-cluster-operator] :
部署redis-cluster-operator:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 git clone https://github.com/ucloud/redis-cluster-operator.git kubectl create -f deploy/crds/redis.kun_distributedredisclusters_crd.yaml kubectl create -f deploy/crds/redis.kun_redisclusterbackups_crd.yaml kubectl create -f deploy/service_account.yaml kubectl create -f deploy/cluster/cluster_role.yaml kubectl create -f deploy/cluster/cluster_role_binding.yaml kubectl create -f deploy/cluster/operator.yaml kubectl get deployment NAME READY UP-TO-DATE AVAILABLE AGE redis-cluster-operator 1/1 1 1 1d kubectl apply -f deploy/example/redis.kun_v1alpha1_distributedrediscluster_cr.yaml kubectl get distributedrediscluster NAME MASTERSIZE STATUS AGE example-distributedrediscluster 3 Scaling 11s kubectl get all -l redis.kun/name=example-distributedrediscluster NAME READY STATUS RESTARTS AGE pod/drc-example-distributedrediscluster-0-0 1/1 Running 0 2m48s pod/drc-example-distributedrediscluster-0-1 1/1 Running 0 2m8s pod/drc-example-distributedrediscluster-1-0 1/1 Running 0 2m48s pod/drc-example-distributedrediscluster-1-1 1/1 Running 0 2m13s pod/drc-example-distributedrediscluster-2-0 1/1 Running 0 2m48s pod/drc-example-distributedrediscluster-2-1 1/1 Running 0 2m15s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/example-distributedrediscluster ClusterIP 172.17.132.71 <none> 6379/TCP,16379/TCP 2m48s service/example-distributedrediscluster-0 ClusterIP None <none> 6379/TCP,16379/TCP 2m48s service/example-distributedrediscluster-1 ClusterIP None <none> 6379/TCP,16379/TCP 2m48s service/example-distributedrediscluster-2 ClusterIP None <none> 6379/TCP,16379/TCP 2m48s NAME READY AGE statefulset.apps/drc-example-distributedrediscluster-0 2/2 2m48s statefulset.apps/drc-example-distributedrediscluster-1 2/2 2m48s statefulset.apps/drc-example-distributedrediscluster-2 2/2 2m48s kubectl get distributedrediscluster NAME MASTERSIZE STATUS AGE example-distributedrediscluster 3 Healthy 4m
至此,redis-cluster集群部署完成。(注意:这样部署下来,没有对redis数据进行持久化 )