gpt4 book ai didi

docker - redis-ha : Unable to create specified number of masters in cluster

转载 作者:可可西里 更新时间:2023-11-01 11:25:03 25 4
gpt4 key购买 nike

我正在尝试使用以下命令创建一个由 3 个主节点、3 个从节点和 3 个哨兵组成的集群。

helm install --set replicas.master=3 --set replicas.slave=3 stable/redis-ha

但我看到只有 1 个 master 被创建。 Helm ——版本 0.2.3GIT repo :https://github.com/kubernetes/charts/tree/master/stable/redis-ha

以下是 helm 的日志。

=>     NAME                         DESIRED  CURRENT  AGE
=> eloping-fox-redis-ha-master 3 1 9s

我是不是遗漏了什么或者有什么问题?我已经尝试了这多个项目,每次只创建 1 个母版。

我正在使用 VM/Minikube/Docker 在 Windows 机器上尝试这个。

PS C:\Users\rootus> helm install --set replicas.master=3 --set replicas.slave=3  stable/redis-ha
NAME: eloping-fox
LAST DEPLOYED: Wed Nov 1 16:34:58 2017
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1beta1/Deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
eloping-fox-redis-ha 3 3 3 0 9s
eloping-fox-redis-ha-sentinel 3 3 3 0 9s

==> v1beta1/StatefulSet
NAME DESIRED CURRENT AGE
eloping-fox-redis-ha-master 3 1 9s

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
eloping-fox-redis-ha-167683871-2rhn8 0/1 ContainerCreating 0 9s
eloping-fox-redis-ha-167683871-cmjjk 0/1 ContainerCreating 0 9s
eloping-fox-redis-ha-167683871-jf4sn 0/1 ContainerCreating 0 9s
eloping-fox-redis-ha-sentinel-2596454939-9qq06 0/1 ContainerCreating 0 9s
eloping-fox-redis-ha-sentinel-2596454939-ngwcf 0/1 ContainerCreating 0 9s
eloping-fox-redis-ha-sentinel-2596454939-pwkbx 0/1 ContainerCreating 0 9s

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
redis-sentinel ClusterIP 10.0.0.122 <none> 26379/TCP 9s
eloping-fox-redis-ha ClusterIP 10.0.0.149 <none> 6379/TCP 9s


NOTES:
Redis cluster can be accessed via port 6379 on the following DNS name from within your cluster:
eloping-fox-redis-ha.default.svc.cluster.local

To connect to your Redis server:

1. Run a Redis pod that you can use as a client:

kubectl exec -it eloping-fox-redis-ha-master-0 bash

2. Connect using the Redis CLI:

redis-cli -h eloping-fox-redis-ha.default.svc.cluster.local

============================================= ==

最佳答案

使用 stable/redis-ha 一切正常 Helm 图。

这似乎是您的 minikube 的问题环境。

默认 minikube使用 2 CPU 启动 VM和 2048M RAM .

来自 stable/redis-ha 的默认 CPU 和内存资源 Helm 图如下:

resources:
master:
requests:
memory: 200Mi
cpu: 100m
limits:
memory: 700Mi
slave:
requests:
memory: 200Mi
cpu: 100m
limits:
memory: 200Mi
sentinel:
requests:
memory: 200Mi
cpu: 100m
limits:
memory: 200Mi

部署时 stable/redis-ha Helm chart 与 3 masters3 slaves它只创建 1 master ,因为你的 VM 上缺少带有 minikube 的资源:

$ kubectl get pod
NAME READY STATUS RESTARTS AGE
melting-armadillo-redis-ha-2438719374-8ghdn 1/1 Running 0 2m
melting-armadillo-redis-ha-2438719374-rlq24 1/1 Running 0 2m
melting-armadillo-redis-ha-2438719374-zlg4p 1/1 Running 0 2m
melting-armadillo-redis-ha-master-0 2/2 Running 0 2m
melting-armadillo-redis-ha-master-1 0/2 Pending 0 4s
melting-armadillo-redis-ha-sentinel-1377673986-004m8 1/1 Running 0 2m
melting-armadillo-redis-ha-sentinel-1377673986-gcpj2 1/1 Running 0 2m
melting-armadillo-redis-ha-sentinel-1377673986-jh73w 1/1 Running 0 2m

第二个redis master的Pod有Pending状态因为:

  FirstSeen LastSeen    Count   From            SubObjectPath   Type        Reason          Message
--------- -------- ----- ---- ------------- -------- ------ -------
16s 1s 6 default-scheduler Warning FailedScheduling No nodes are available that match all of the following predicates:: Insufficient memory (1).

所以您有两种方法可以解决您的问题:

  1. 创建您的 minikube环境至少 4096M RAM .
  2. 部署 stable/redis-ha Helm chart 与 3 masters3 slaves内存资源减少。

第一种方式是:

开始minikube4096M RAM :

$ minikube start --memory 4096
Starting local Kubernetes v1.7.5 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.

部署 stable/redis-ha Helm chart 与 3 masters3 slaves :

$ helm install --set replicas.master=3 --set replicas.slave=3 stable/redis-ha 

最后我们得到:

$ kubectl get pod
NAME READY STATUS RESTARTS AGE
maudlin-ladybug-redis-ha-1801622981-brmqp 1/1 Running 0 3m
maudlin-ladybug-redis-ha-1801622981-klhr1 1/1 Running 0 3m
maudlin-ladybug-redis-ha-1801622981-mpf3j 1/1 Running 0 3m
maudlin-ladybug-redis-ha-master-0 2/2 Running 0 3m
maudlin-ladybug-redis-ha-master-1 2/2 Running 0 1m
maudlin-ladybug-redis-ha-master-2 2/2 Running 0 1m
maudlin-ladybug-redis-ha-sentinel-3633913943-f8x2c 1/1 Running 0 3m
maudlin-ladybug-redis-ha-sentinel-3633913943-ltvk4 1/1 Running 0 3m
maudlin-ladybug-redis-ha-sentinel-3633913943-xwclg 1/1 Running 0 3m

第二种方式是:

部署 stable/redis-ha Helm chart 与 3 masters3 slaves并减少内存资源:

helm install --set replicas.master=3 --set replicas.slave=3 --set resources.master.requests.memory=100Mi --set resources.slave.requests.memory=100Mi --set resources.sentinel.requests.memory=100Mi stable/redis-ha

最后我们得到:

$ kubectl get pod
NAME READY STATUS RESTARTS AGE
exacerbated-jellyfish-redis-ha-3444643229-085f4 1/1 Running 0 43s
exacerbated-jellyfish-redis-ha-3444643229-bl221 1/1 Running 0 43s
exacerbated-jellyfish-redis-ha-3444643229-qx62b 1/1 Running 0 43s
exacerbated-jellyfish-redis-ha-master-0 2/2 Running 0 43s
exacerbated-jellyfish-redis-ha-master-1 2/2 Running 0 36s
exacerbated-jellyfish-redis-ha-master-2 2/2 Running 0 29s
exacerbated-jellyfish-redis-ha-sentinel-1441222589-czsvx 1/1 Running 0 43s
exacerbated-jellyfish-redis-ha-sentinel-1441222589-ql6n6 1/1 Running 0 43s
exacerbated-jellyfish-redis-ha-sentinel-1441222589-qql1f 1/1 Running 0 43s

关于docker - redis-ha : Unable to create specified number of masters in cluster,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47069977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com