Update Redis.md

调整配图:用图标表示服务、数据库、请求等元素,并在图中标出具体的数据。
This commit is contained in:
CyC2018
2026-10-26 04:42:09 +08:00
parent 149968c406
commit b7af2602ba
2 changed files with 50 additions and 36 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 155 KiB

+50 -36
View File
@@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="340" viewBox="0 0 720 340">
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="360" viewBox="0 0 720 360">
<style>
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #666; font-size: 12px; }
.title { font-weight: bold; font-size: 15px; fill: #777; text-anchor: middle; }
@@ -31,39 +31,53 @@
<rect width="100%" height="100%" fill="#FFFFFF"/>
<text x="360" y="28" class="title">Redis Cluster:3 主 3 从</text>
<rect x="22" y="54" width="210" height="54" rx="6" class="shadow"/>
<rect x="20" y="52" width="210" height="54" rx="6" fill="#DDD7F6"/>
<text x="125" y="74" class="c b mono">user:1001</text>
<text x="125" y="94" class="c sub mono">CRC16(key) % 16384 = 5712</text>
<rect x="252" y="152" width="140" height="52" rx="6" class="shadow"/>
<rect x="250" y="150" width="140" height="52" rx="6" fill="#B1DDF0"/>
<text x="320" y="174" class="b c">主节点 7001</text>
<text x="320" y="189" class="sub c">槽 0~5460</text>
<rect x="262" y="252" width="120" height="36" rx="6" class="shadow"/>
<rect x="260" y="250" width="120" height="36" rx="6" fill="#E6E6E6"/>
<text x="320" y="272.5" class="b c">从节点</text>
<line x1="320" y1="205" x2="320" y2="246" class="arrow dash"/>
<rect x="402" y="152" width="140" height="52" rx="6" class="shadow"/>
<rect x="400" y="150" width="140" height="52" rx="6" fill="#B1DDF0"/>
<text x="470" y="174" class="b c">主节点 7002</text>
<text x="470" y="189" class="sub c">槽 5461~10922</text>
<rect x="412" y="252" width="120" height="36" rx="6" class="shadow"/>
<rect x="410" y="250" width="120" height="36" rx="6" fill="#E6E6E6"/>
<text x="470" y="272.5" class="b c">从节点</text>
<line x1="470" y1="205" x2="470" y2="246" class="arrow dash"/>
<rect x="552" y="152" width="140" height="52" rx="6" class="shadow"/>
<rect x="550" y="150" width="140" height="52" rx="6" fill="#B1DDF0"/>
<text x="620" y="174" class="b c">主节点 7003</text>
<text x="620" y="189" class="sub c">槽 10923~16383</text>
<rect x="562" y="252" width="120" height="36" rx="6" class="shadow"/>
<rect x="560" y="250" width="120" height="36" rx="6" fill="#E6E6E6"/>
<text x="620" y="272.5" class="b c">从节点</text>
<line x1="620" y1="205" x2="620" y2="246" class="arrow dash"/>
<text x="325" y="236" class="sub">异步复制</text>
<path d="M232,92 C330,96 440,110 470,146" class="arrow"/>
<text x="380" y="104" class="c sub">槽 5712 在 7002</text>
<text x="20" y="128" class="sub note">如果发给 7001:MOVED 5712 127.0.0.1:7002</text>
<path d="M100,136 C100,166 200,176 246,176" class="arrow red dash"/>
<text x="20" y="312" class="sub">{user:1001}:cart 和 {user:1001}:orders 只按 {} 中的部分计算,都在槽 5712,可以在同一条命令或 Lua 脚本中使用</text>
<text x="20" y="330" class="sub">主节点宕机后,从节点被选为新的主节点;本机 cluster-node-timeout 为 5 秒时,这部分槽约 9 秒无法写入</text>
<rect x="40" y="50" width="390" height="32" rx="3" fill="#DDD7F6" stroke="#A99FD8" stroke-width="1.2"/>
<path d="M40,51 L54,61 L68,51" fill="none" stroke="#A99FD8" stroke-width="1"/>
<text x="74" y="70" class="sub mono">SET user:1001 … CRC16(user:1001) % 16384 = 5712</text>
<rect x="40.0" y="120" width="213.3" height="22" fill="#B1DDF0" stroke="#FFFFFF" stroke-width="2"/>
<text x="146.641" y="135" class="c sub">槽 0~5460</text>
<rect x="253.3" y="120" width="213.4" height="22" fill="#B0E3E6" stroke="#FFFFFF" stroke-width="2"/>
<text x="359.98" y="135" class="c sub">槽 5461~10922</text>
<rect x="466.7" y="120" width="213.3" height="22" fill="#E6E6E6" stroke="#FFFFFF" stroke-width="2"/>
<text x="573.32" y="135" class="c sub">槽 10923~16383</text>
<text x="40" y="114" class="sub">0</text>
<text x="680" y="114" class="e sub">16383</text>
<path d="M190,86 C190,104 263.1,100 263.1,118" class="arrow"/>
<line x1="263.1" y1="120" x2="263.1" y2="142" stroke="#9188D8" stroke-width="2.5"/>
<text x="269.125" y="114" class="b">5712</text>
<line x1="146.641" y1="144" x2="146.641" y2="168" class="line"/>
<path d="M122.641,176 v36 a24,6 0 0 0 48,0 v-36" fill="#B1DDF0" stroke="#7FB4D0" stroke-width="1.2"/>
<ellipse cx="146.641" cy="176" rx="24" ry="6" fill="#B1DDF0" stroke="#7FB4D0" stroke-width="1.2"/>
<path d="M122.641,194 a24,6 0 0 0 48,0" fill="none" stroke="#7FB4D0" stroke-width="1"/>
<text x="146.641" y="236" class="c b">主节点 7001</text>
<line x1="146.641" y1="242" x2="146.641" y2="262" class="arrow dash"/>
<path d="M128.641,270 v24 a18,6 0 0 0 36,0 v-24" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1.2"/>
<ellipse cx="146.641" cy="270" rx="18" ry="6" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1.2"/>
<path d="M128.641,282 a18,6 0 0 0 36,0" fill="none" stroke="#BBBBBB" stroke-width="1"/>
<text x="146.641" y="316" class="c sub">从节点</text>
<line x1="359.98" y1="144" x2="359.98" y2="168" class="line"/>
<path d="M335.98,176 v36 a24,6 0 0 0 48,0 v-36" fill="#B0E3E6" stroke="#78BFC4" stroke-width="1.2"/>
<ellipse cx="359.98" cy="176" rx="24" ry="6" fill="#B0E3E6" stroke="#78BFC4" stroke-width="1.2"/>
<path d="M335.98,194 a24,6 0 0 0 48,0" fill="none" stroke="#78BFC4" stroke-width="1"/>
<text x="359.98" y="236" class="c b">主节点 7002</text>
<line x1="359.98" y1="242" x2="359.98" y2="262" class="arrow dash"/>
<path d="M341.98,270 v24 a18,6 0 0 0 36,0 v-24" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1.2"/>
<ellipse cx="359.98" cy="270" rx="18" ry="6" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1.2"/>
<path d="M341.98,282 a18,6 0 0 0 36,0" fill="none" stroke="#BBBBBB" stroke-width="1"/>
<text x="359.98" y="316" class="c sub">从节点</text>
<line x1="573.32" y1="144" x2="573.32" y2="168" class="line"/>
<path d="M549.32,176 v36 a24,6 0 0 0 48,0 v-36" fill="#E6E6E6" stroke="#B5B5B5" stroke-width="1.2"/>
<ellipse cx="573.32" cy="176" rx="24" ry="6" fill="#E6E6E6" stroke="#B5B5B5" stroke-width="1.2"/>
<path d="M549.32,194 a24,6 0 0 0 48,0" fill="none" stroke="#B5B5B5" stroke-width="1"/>
<text x="573.32" y="236" class="c b">主节点 7003</text>
<line x1="573.32" y1="242" x2="573.32" y2="262" class="arrow dash"/>
<path d="M555.32,270 v24 a18,6 0 0 0 36,0 v-24" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1.2"/>
<ellipse cx="573.32" cy="270" rx="18" ry="6" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1.2"/>
<path d="M555.32,282 a18,6 0 0 0 36,0" fill="none" stroke="#BBBBBB" stroke-width="1"/>
<text x="573.32" y="316" class="c sub">从节点</text>
<text x="176.641" y="256" class="sub">异步复制</text>
<path d="M176.6,196 C226.6,178 280.0,178 330.0,196" class="arrow red dash"/>
<text x="253.311" y="160" class="c sub" style="fill:#C0605A">发给 7001:MOVED 5712 → 7002</text>
<text x="20" y="338" class="sub">{user:1001}:cart、{user:1001}:orders 只按 {} 中的部分计算,都在槽 5712,可以在同一条命令或 Lua 脚本中使用</text>
<text x="20" y="354" class="sub">主节点宕机后从节点被选为新的主节点;本机 cluster-node-timeout 为 5 秒时,这部分槽约 9 秒无法写入</text>
</svg>

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB