【Redis】Redis 分片集群的渐进式扩容、缩容、管理
Redis高可拓展-分片技術(Redis Cluster)
方案
dictht[1]:擴容縮容分片集群
dictht[0]:待回收分片集群(回收機器前的過渡集群)
shard*: redis分片機器(分片機器:哨兵+主從模式)
1.擴容前
dictht[1]:[shard1,shard2,shard3]
dictht[0]:[]
2.擴容
dictht[1]:[shard4,shard5,shard6,shard7,shard8,shard9]
dictht[0]:[shard1,shard2,shard3]
3.縮容
dictht[1]:[shard1,shard2,shard3]
dictht[0]:[shard4,shard5,shard6,shard7,shard8,shard9]
4.回收機器
dictht[1]:[shard1,shard2,shard3]
dictht[0]:[]
查詢操作: 先從dictht[1]查詢,查詢不到就查詢dictht[0]
新增修改刪除操作:新增修改刪除dictht[1],刪除dictht[0] (只要數據命中dictht[1]的分片與dictht[0]的分片不一樣,就干掉dictht[0]數據,因為dictht[0]是一個待回收的分片集群,等dictht[0]里面的數據刪完了就回收機器)
漸進式擴容需注意事項
1.dictht[1]與dictht[0]的分片機器不要一樣,不然回收機器的時候,dictht[1]與dictht[0]有一樣的分片,但是dictht[0]數據沒有刪除干凈,dictht[1]該分片就產生了垃圾數據
2.回收的時候應盡可能讓dictht[0]數據清完回收,不然就會丟失redis數據(根據具體應用場景及成本考慮調整回收時間點)
總結
以上是生活随笔為你收集整理的【Redis】Redis 分片集群的渐进式扩容、缩容、管理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C4D卡死和运行中一点击模型填充颜色就卡
- 下一篇: 机载雷达导论(第29~36章)