IT Panda Blog

Life is fantastic


  • Home

  • Tags

  • Categories

  • Archives

Redis reshard issue - timeout

Posted on 2019-09-12 In Redis

线上的Redis集群使用的是5台Node组成的Redis Cluster,之前有一台node宕机重启之后,Redis service启动了,也还在Cluster内,但是一直不给分配slot.

就是说,16382个slot本来可以被均匀的分配到这5台node上,但现在只分配给其中的4台,第5个虽然可以接收client发送过来的请求,但是只能做到redirect request…

那只好手动reshard一下,将一部分的slot转移到第5台node上.


开始操作

1
./redis-cli --cluster reshard <node-5>

但是会hang住,并一会儿就timeout了… 反复了几次,reshard都失败了…

问题排查

既然报timeout错误,那就要找原因; 首先可以肯定的是migrate slot的timeout,然后再查看下slot是不是很大,或者说,是不是kv很大

下面的几个命令有助于分析

1
2
3
4
5
6
redis自带的分析大key的命令
./redis-cli -h <node> -p <port> --bigkeys

分析slowlog
./redis-cli
<node> > SLOWLOG GET

使用上述命令确认了,kv都不小slot也是,所以reshard在migrate slot的时候,会需要一段时间,而默认的timeout不足以完成,所以需要跳大timeout, 需要加上---timeout xx, 再试.

1
./redis-cli --cluster reshard <node> --cluster-timeout 120000

Done, 成功了!

但是还没完, 还需要rebalance一下, 平衡各个node之间的slot分布

1
./redis-cli --cluster rebalance <node>
Redis
Agile: Epic vs User-Story vs Task
Docker <none>:<none> - dangling
  • Table of Contents
  • Overview
Rex

Rex

25 posts
26 categories
49 tags
Links
  • GitHub
  1. 1. 开始操作
  2. 2. 问题排查
© 2019 – 2020 作者拥有版权,转载请注明出处