当前位置:   article > 正文

helm部署redis集群_helm 设置redis 大小

helm 设置redis 大小
helm部署redis集群
一:
配置:
		nfs存储:100G
		节点1:node1-iot.com 192.168.0.201
		节点2:node2-iot.com 192.168.0.202
		节点3:node3-iot.com 192.168.0.204

二:部署storageclass
[root@master-iot ~]# kubectl get nodes
NAME             STATUS   ROLES    AGE   VERSION
master-iot.com   Ready    master   37h   v1.17.0
node1-iot.com    Ready    <none>   37h   v1.17.0
node2-iot.com    Ready    <none>   37h   v1.17.0
node3-iot.com    Ready    <none>   24m   v1.17.0
[root@master-iot ~]# helm install stable/nfs-client-provisioner --set nfs.server=192.168.0.203 --set nfs.path=/opt
注意修改nfs地址和路径
[root@master-iot ~]# kubectl get pods
NAME                                                   READY   STATUS    RESTARTS   AGE
giggly-goose-nfs-client-provisioner-7b94d4dc4f-6dhw4   1/1     Running   0          53m

三:helm部署redis集群
[root@master-iot redis]# cat values.yaml 
image:
  repository: redis
  tag: 5.0.5
  pullPolicy: IfNotPresent
redis:
  resources:
    requests:
      memory: 200Mi
      cpu: 100m
    limits:
      memory: 700Mi
sentinel:
  resources:
    requests:
      memory: 200Mi
      cpu: 100m
    limits:
      memory: 200Mi
persistentVolume:
  enabled: true
  storageClass: "nfs-client"
  accessModes:
    - ReadWriteOnce
  size: 10Gi
[root@master-iot redis]# helm install stable/redis-ha --name=redis-ha --namespace=redis
[root@master-iot redis]# kubectl get all -n redis
NAME                    READY   STATUS    RESTARTS   AGE
pod/redis-ha-server-0   2/2     Running   3          24m
pod/redis-ha-server-1   2/2     Running   0          24m
pod/redis-ha-server-2   2/2     Running   0          24m

NAME                          TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)              AGE
service/redis-ha              ClusterIP   None            <none>        6379/TCP,26379/TCP   24m
service/redis-ha-announce-0   ClusterIP   10.96.177.155   <none>        6379/TCP,26379/TCP   24m
service/redis-ha-announce-1   ClusterIP   10.96.255.63    <none>        6379/TCP,26379/TCP   24m
service/redis-ha-announce-2   ClusterIP   10.96.166.228   <none>        6379/TCP,26379/TCP   24m

NAME                               READY   AGE
statefulset.apps/redis-ha-server   3/3     24m

四:测试
[root@master-iot redis]# kubectl get svc -n redis
NAME                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)              AGE
redis-ha              ClusterIP   None            <none>        6379/TCP,26379/TCP   25m
redis-ha-announce-0   ClusterIP   10.96.177.155   <none>        6379/TCP,26379/TCP   25m
redis-ha-announce-1   ClusterIP   10.96.255.63    <none>        6379/TCP,26379/TCP   25m
redis-ha-announce-2   ClusterIP   10.96.166.228   <none>        6379/TCP,26379/TCP   25m
[root@master-iot redis]# redis-cli -h 10.96.166.228 -p 6379
10.96.166.228:6379> INFO replication
# Replication
role:master
connected_slaves:2
min_slaves_good_slaves:2
slave0:ip=10.96.255.63,port=6379,state=online,offset=218033,lag=1
slave1:ip=10.96.177.155,port=6379,state=online,offset=218174,lag=0
master_replid:ebe58c1995af9ee29119744503a20a805aab28ae
master_replid2:7ff4e6ea64e6f76766409679e6f6d18867dfa7f2
master_repl_offset:218174
second_repl_offset:26098
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:868
repl_backlog_histlen:217307
10.96.166.228:6379> set foo1 bar1
OK
10.96.166.228:6379> set foo2 bar2
OK
[root@master-iot redis]# redis-cli -h 10.96.255.63  -p 6379
10.96.255.63:6379> KEYS *
1) "foo1"
2) "foo2"
接下来删除一个pod看是否重建
[root@master-iot redis]# kubectl get pods -n redis
NAME                READY   STATUS    RESTARTS   AGE
redis-ha-server-0   2/2     Running   3          32m
redis-ha-server-1   2/2     Running   0          32m
redis-ha-server-2   2/2     Running   0          32m
[root@master-iot redis]# kubectl delete pod redis-ha-server-0 -n redis
pod "redis-ha-server-0" deleted
[root@master-iot redis]# kubectl get pods -n redis
NAME                READY   STATUS    RESTARTS   AGE
redis-ha-server-0   2/2     Running   0          18s
redis-ha-server-1   2/2     Running   0          33m
redis-ha-server-2   2/2     Running   0          33m
重建完毕
[root@master-iot redis]# redis-cli -h 10.96.177.155 -p 6379
10.96.177.155:6379> KEYS *
1) "foo1"
2) "foo2"
数据保持一致
  • 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
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/246465
推荐阅读
相关标签
  

闽ICP备14008679号