获取redis cluster主从关系
需求:使用cluster slots命令,获取redis cluster 主从对应关系。
说明:cluster slots命令对应的字段说明:http://redis.cn/commands/cluster-slots.html
redis-cli -h IP -p PORT -a PASSWD -c cluster slots | xargs -n8 | awk ‘{print $3":"$4"->"$6":"$7}‘ | sort -nk2 -t ‘:‘ | uniq
测试结果:
[ ~]$ redis-cli -h 5.5.5.101 -p 29001 -c cluster slots | xargs -n8 | awk ‘{print $3":"$4"->"$6":"$7}‘ | sort -nk2 -t ‘:‘ | uniq 5.5.5.102:29001->5.5.5.101:29001 5.5.5.103:29002->5.5.5.102:29002 5.5.5.101:29003->5.5.5.103:29003
相关推荐
王道革 2020-11-25
wangdonghello 2020-11-03
Langeldep 2020-11-16
chenhualong0 2020-11-16
聚合室 2020-11-16
koushr 2020-11-12
MRFENGG 2020-11-11
guoyanga 2020-11-10
fackyou00 2020-11-10
Orangesss 2020-11-03
dongCSDN 2020-10-31
rainandtear 2020-10-30
Quietboy 2020-10-30
liuyulong 2020-10-29
fansili 2020-10-29
温攀峰 2020-10-23
jackbon 2020-10-19
kaixinfelix 2020-10-04