需求:使用cluster slots命令,获取redis cluster 主从对应关系。

 

说明:cluster slots命令对应的字段说明:http://redis.cn/commands/cluster-slots.html

 

redis-cli -h 5.5.5.101 -p 29001 -c cluster slots | xargs  -n8 | awk '{print $3":"$4"->"$6":"$7}' | sort -nk2 -t ':' | uniq

 

测试结果:

[redis@lxd-vm1 ~]$ 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

 

相关文章:

  • 2022-12-23
  • 2021-08-19
  • 2021-06-08
  • 2021-10-29
  • 2021-07-21
  • 2021-08-16
  • 2021-09-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2021-06-16
相关资源
相似解决方案