Support clients to access kvrocks cluster using LB

Aperta
#3,089 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp, redis

Direzione di ricerca

Inizia tracciando il comando CLUSTERX SETNODES e i percorsi di persistenza e caricamento di nodes.conf. Esamina quindi la gestione dei comandi cluster nodes, slots e replicas. Il lavoro è completato quando gli indirizzi LB opzionali persistono dopo i riavvii, le risposte del cluster rivolte ai client li utilizzano e la sincronizzazione interna e la migrazione degli slot mantengono gli IP locali.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Search before asking
  • I had searched in the issues and found no similar issues.
Motivation

In the following situations, a master-slave switchover in a Kvrocks cluster may cause a split-brain situation:

  1. The Kvrocks process hangs and then recovers
  2. The network card on the Kvrocks host fails and then recovers
  3. The network partition on the Kvrocks host recovers
    When the Kvrocks process regains access, client requests may be directed to the old master node for a brief period, causing a split-brain situation and data inconsistency.
    If clients access Kvrocks using a load balancer (LB), when a Kvrocks cluster switchover occurs, redirecting the LB address to the new master node ensures that client requests are not forwarded to the old master node.
    The Kvrocks cluster deployment architecture is as follows:
Image

Benefits of this architecture:

  1. It covers most split-brain scenarios, including process restarts, process hangs, host network interface downtime, and network partitions.
  2. Using a load balancer (LB) accelerates failover, significantly faster than approaches such as using dynamic domain names on the client side.

This approach is used in both AWS Elasticache and Azure Redis.

Solution

To ensure that client access to the KvRocks cluster goes through the load balancer (LB), while maintaining local IP for internal KvRocks cluster communication (master-slave synchronization and slot migration), the following modifications are required:

  1. Add two optional parameters to the clusterx setnodes command to specify a CLB host for each node.
    The following example shows that you can specify some or all LBs:
    CLUSTERX SETNODES "ZrFserb4Mqi5dbyCLCMUm9zFXMNPhzKE4RbFauJa 10.190.28.10 7115 master - 0-5460 \n qhbVLW9dc2VF9CZOmvBJOzzqkhNA3oHoD3NVWVyg 10.190.28.10 7133 master - 5461-10921 \n 9cnjXnaNK5KfPtX01V0wn7ZtM7FDPnz7va9qPJBs 10.190.28.10 7237 master - 10922-16383 192.168.0.2 1222\n fuCHh8Ru9tFSY313QPfBcPQ3QeP63Z4rWpqpyaOl 10.190.28.10 7255 slave ZrFserb4Mqi5dbyCLCMUm9zFXMNPhzKE4RbFauJa \n cIqdj5C37cMrr7r7ydZDZ8zm1T1vPLMWj8516rrF 10.190.28.10 6741 slave qhbVLW9dc2VF9CZOmvBJOzzqkhNA3oHoD3NVWVyg \n 3D8JRN8YVONqRU57jP99E3JdH2QnLHzZpFN4rcQQ 10.190.28.10 6765 slave 9cnjXnaNK5KfPtX01V0wn7ZtM7FDPnz7va9qPJBs 192.168.0.1 1234" 1754120940

  2. When persisting nodes.conf to a local file, add the LB address information to the file. When the kvrovks process starts, it will also load the corresponding LB address information.

  3. When executing the cluster nodes/slots/replicas commands, if the nodes have a LB host configured, replace it with LB host.

Are you willing to submit a PR?
  • I'm willing to submit a PR!
Lingua principale
C++
Stelle
4.5k
Fork
686
Merge medio
2g 13h
PR unite (30g)
40

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/kvrocks

Tutte le issue di apache/kvrocks

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.