Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
How do I select the master Redis pod in this Kubernetes example?

Here's the example I have modeled after.

In the Readme's "Delete our manual pod" section:

  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.

How do I select the new master? All 3 Redis server pods controlled by the redis replication controller from redis-controller.yaml still have the same

labels:
  name: redis

which is what I currently use in my Service to select them. How will the 3 pods be distinguishable so that from Kubernetes I know which one is the master?

about 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

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

Kubernetes isnt aware of the master nodes. You can find the pod manually by connecting to it and using:

redis-cli info

You will get lots of information about the server but we need role for our purpose:

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

Please note Replication controllers are replaced by Deployments for stateless services. For stateful services use Statefulsets.

about 4 years ago · Santiago Trujillo Relatório

0

Your client Redis library can actually handle this. For example with ioredis:

ioredis guarantees that the node you connected to is always a master even after a failover.

So, you actually connect to a redis-sentinel instead of a redis-client.

about 4 years ago · Santiago Trujillo Relatório

0

We need to do the same thing and tried different things like modifying chart. Finally, just created a simple python docker that does the labeling and created chart that expose the master redis as service. This periodically checked the pods create for redis-ha and label them according to their role ( master/ slave)

It uses the same sentinel commands to find the master/slave.

helm chart redis-pod-labeler here source repo

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda