gpt4 book ai didi

node.js - 如何在此 Kubernetes 示例中选择主 Redis pod?

转载 作者:IT王子 更新时间:2023-10-29 06:00:46 25 4
gpt4 key购买 nike

这是 example我模仿过。

在自述文件的“删除我们的手动 pod”部分:

  1. The redis sentinels themselves, realize that the master has disappeared from the cluster, and begin the election procedure for selecting a new master. They perform this election and selection, and chose one of the existing redis server replicas to be the new master.

如何选择新的主人? redis-controller.yaml 中的 redis 复制 Controller 控制的所有 3 个 Redis 服务器 pod 仍然具有相同的

labels:
name: redis

这是我目前在我的服务中用来选择它们的内容。如何区分这 3 个 pod,以便我从 Kubernetes 知道哪个是 master?

最佳答案

How will the 3 pods be distinguishable so that from Kubernetes I know which one is the master?

Kubernetes 不知道主 Node 。您可以通过连接到 Pod 并使用以下命令手动找到 Pod:

redis-cli info

您将获得有关服务器的大量信息,但我们需要角色来实现我们的目的:

redis-cli info | grep ^role
Output:
role: Master

请注意,对于无状态服务,Replication controllers 已替换为 Deployments。对于有状态服务,请使用 Statefulsets

关于node.js - 如何在此 Kubernetes 示例中选择主 Redis pod?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42827242/

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