Redis开发运维常见问题
标签:Redis

Redis开发运维常见问题

1. 集群完整性

2. 带宽消耗

3. Pub/Sub广播

我们对任意一个节点执行publish,它会在集群每个节点广播,加重了带宽。

4. 数据倾斜

节点和槽分配不均

[root@localhost redis]# ./src/redis-trib.rb info 192.168.91.136:7002
192.168.91.136:7003 (23b40bb3...) -> 0 keys | 5462 slots | 1 slaves.
192.168.91.136:7004 (bd3e0d6c...) -> 0 keys | 5461 slots | 1 slaves.
192.168.91.136:7000 (41151b98...) -> 16 keys | 5461 slots | 1 slaves.
[OK] 16 keys in 3 masters.
0.00 keys per slot on average.
[root@localhost redis]# ./src/redis-trib.rb rebalance 192.168.91.136:7000
>>> Performing Cluster Check (using node 192.168.91.136:7000)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
*** No rebalancing needed! All nodes are within the 2.0% threshold.

不同槽对应的键值数量差异较大

包含bigkey

内存相关配置不一致

5. 请求倾斜

热点key:重要的key或者bigkey

优化:

  • 3 min read

CONTRIBUTORS


  • 3 min read