【问题标题】:Redis sentinel cluster in kubernetes, sentinel is not able to reach redis masterKubernetes中的Redis哨兵集群,哨兵无法到达redis master
【发布时间】:2020-03-15 15:44:50
【问题描述】:

我正在使用以下方法创建一个 Redis 哨兵集群:

https://github.com/kubernetes/examples/tree/master/staging/storage/redis

使用给定的图像效果很好,但是当我们使用 Redis 官方图像时,哨兵无法连接到第一个 pod 中的 Redis。

显示如下错误:

无法在 -p:6379 连接到 redis

如何使用Redis的官方镜像创建集群?

【问题讨论】:

  • 嗨,官方图片是指Redis的官方dockerimage
  • 你是如何用官方镜像创建集群的?
  • 嗨 piotr,是的,我正在使用 redis 的官方 docker 镜像。
  • 我只是按照上面的 git url 并使用 redis 图像而不是 alpine。
  • 您是否在您的 pod 中使用 --sentinel 启动了哨兵容器?您是否还使用了一个 sentinel.conf 文件来告诉它谁是主人? (监控主)

标签: docker kubernetes redis redis-sentinel


【解决方案1】:

要将图像从 google 存储库替换为公共 docker hub 图像,需要为此示例修改以下部署文件:

examples/staging/storage/redis/redis-master.yaml
examples/staging/storage/redis/redis-sentinel-service.yaml
examples/staging/storage/redis/redis-controller.yaml

在这些文件中你会发现像这样的图像配置:

spec:
      containers:
      - name: sentinel
        image: k8s.gcr.io/redis:v1

将所有image: k8s.gcr.io/redis:v1 替换为image: redis:stableimage: redis:latest

修改这些图像配置后应如下所示:

spec:
      containers:
      - name: sentinel
        image: redis:stable

您提到的 dockerfile 中的 alpine 映像用于运行脚本以删除尾随空格。


更新:

经过进一步调查,此示例似乎使用了 GCR 存储库中的特定 redis image,并且将其替换为官方 redis 映像将不起作用。

如果你想在 kubernetes 中部署 redis,我建议使用bitnami-docker-redis github 项目。有关在 kubernetes 上安装它的更多信息,请访问 here

官方redisgithub页面和redisdocumentation都没有提到在kubernetes上部署redis。

【讨论】:

  • 我已经尝试过上面你提到的,我得到的问题是哨兵无法连接到端口 6379。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-05-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多