Thuta Learning
ရှာဖွေရန်
Redis
AdvancedData & Databasesbeginner

Replication

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Replication concept ကို နားလည်ရှင်းပြနိုင်ရန်
  • နမူနာ Redis command/code ကို ကိုယ်တိုင် run ပြီး output စစ်နိုင်ရန်
  • Tutorial Platform project နှင့် production scenario တွင် မှန်ကန်စွာအသုံးချနိုင်ရန်

နားလည်ထားရမယ့် အချက်

Redis replication က leader writes ကို replicas သို့ asynchronous ပို့ပါတယ်။ Replicas reconnect လျှင် partial/full resynchronization လုပ်နိုင်ပါတယ်။ Async ဖြစ်လို့ acknowledged write တစ်ခု failover အချိန်မရောက်သေးဘဲဆုံးနိုင်ပြီး replica reads က stale ဖြစ်နိုင်ပါတယ်။ `WAIT` က replica acknowledgements စောင့်ပေမယ့် strong consistency မပြောင်းပေးပါ။

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

Read-heavy catalog တွင် stale-tolerant requests သာ replicas သို့ပို့မယ်။ Session create ပြီးချက်ချင်း read လို flow ကို leader မှဖတ်မယ်။ Replication offset/lag၊ link status၊ full sync frequency နဲ့ backlog sizing ကို monitor လုပ်ပြီး failover data-loss test လုပ်မယ်။

အတူတူ စမ်းရေးကြည့်မယ်

shell
INFO replication
ROLE
WAIT 1 1000
CONFIG GET repl-backlog-size
CONFIG GET min-replicas-to-write
CONFIG GET min-replicas-max-lag
You should see
Role၊ replica connectivity/offset နှင့် acknowledgement count ရမည်။

၅ မိနစ် စမ်းကြည့်

Catalog၊ session၊ rate limit သုံးမျိုးထဲ replica reads ခွင့်ပြု/မပြု matrix ရေးပါ။

သတိလေးတစ်ချက်

Replica နှစ်ခုရှိတာကို zero-data-loss guarantee လို့မပြောပါနှင့်။ Failure timing နဲ့ async lag ကိုထည့်တွက်ပါ။

Redis — ReplicationRedis

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Replica နှစ်ခုရှိတာကို zero-data-loss guarantee လို့မပြောပါနှင့်။ Failure timing နဲ့ async lag ကိုထည့်တွက်ပါ။
  • နမူနာ command ကို production Redis ပေါ် တိုက်ရိုက်မစမ်းဘဲ local/test instance နဲ့ recoverable data ပေါ်တွင် အရင်အတည်ပြုပါ။

လေ့ကျင့်ခန်း

Catalog၊ session၊ rate limit သုံးမျိုးထဲ replica reads ခွင့်ပြု/မပြု matrix ရေးပါ။

You'll know it worked when: Role၊ replica connectivity/offset နှင့် acknowledgement count ရမည်။

Replication | Thuta Learning