redis hash 槽
时间: 2023-09-01 15:12:39 浏览: 106
Redis的Hash槽是指一个数组,数组范围是从0到2^14-1,用来存储Redis集群中的数据。Hash槽会被均匀地分配给Redis节点,每个节点负责存储一定数量的Hash槽的数据。例如,节点1负责存储编号0号至5460号的Hash槽,节点2负责存储编号5461号至10922号的Hash槽,节点3负责存储编号10923号至16383号的Hash槽。当需要在Redis集群中存放一个key-value时,Redis会使用crc16算法对key进行哈希取值,并将结果对16384求余数得到该key对应的Hash槽编号。根据节点数量,Redis会将Hash槽大致均等地映射到不同的节点上。这样,每个key都对应一个在0-16383之间的Hash槽编号。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Redis哈希槽的概念](https://blog.csdn.net/weixin_44688973/article/details/125441228)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [Redis 一致性hash、hash槽](https://blog.csdn.net/qq_37102984/article/details/120130656)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文