redis cluster判断key属于那个分片。

一、判断阿里云 redis cluster,的key属于那个分片。

阿里云特有的命令info key 可以查看key属于那个slot,那个分片
命令行查看:

xxxx:6379> info key  xxxx_compressed_xxx
slot:4941 node_index:9
xxxx:6379> cluster keyslot xxxx_compressed_xxx
(integer) 4941
xxxx:6379:6379> 

也可以在dms查看。
在这里插入图片描述
如果实例是安全协同模式,dms安全规则需要增加:
在这里插入图片描述

在这里插入图片描述

// 文档:https://help.aliyun.com/document_detail/131131.html

if
  @fac.cmd_type in ['INFO']
then
  @act.allow_execute
elseif @fac.is_read
then
  @act.reject_execute '该命令被 "允许执行Hash读命令(白名单集合)"安全规则 禁用,需要使用请联系管理员修改模板或走工单流程'
end

二、原生 redis cluster查看方法

cluster nodes 或者 cluster slots 都可以查看所有分片对应slot的范围。

cluster keyslot keyname 命令可以查看某个key 属于那个slot。
以上两种命令结合可以判断key属于那个分片

命令说明
cluster nodes
https://cloud.tencent.com/developer/section/1374002
cluster slots
https://cloud.tencent.com/developer/section/1374009
cluster keyslot
https://cloud.tencent.com/developer/section/1374000

  • 10
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值