Redis客户端连接后操作Redis数据报错“(error) CLUSTERDOWN Hash slot not served”解决方案

  • 问题:客户端连接后操作redis可能会报如下错误:

    127.0.0.1:6379> get title
    (error) CLUSTERDOWN Hash slot not served
    
  • ★★解决方法★★:
    断开客户端连接,敲如下命令检测一下:

    ./redis-cli --cluster check 127.0.0.1:6379
    

    提示如下:

    127.0.0.1:6379 (9a8dd4a7…) -> 0 keys | 0 slots | 0 slaves.
    [OK] 0 keys in 1 masters.
    0.00 keys per slot on average.
    >>> Performing Cluster Check (using node 127.0.0.1:6379)
    M: 9a8dd4a7fe734cbe58196a2d380392c3064dbfe8 127.0.0.1:6379
     slots: (0 slots) master
    [OK] All nodes agree about slots configuration.
    >>> Check for open slots…
    >>> Check slots coverage…
    [ERR] Not all 16384 slots are covered by nodes.

    执行修复命令:

    ./redis-cli --cluster fix 127.0.0.1:6379
    

    中途提示:

    Fix these slots by covering with a random node? (type ‘yes’ to accept):

    输入“yes”,回车
    再次输入上述检测命令,提示如下,则修复成功:

    127.0.0.1:6379 (9a8dd4a7…) -> 0 keys | 16384 slots | 0 slaves.
    [OK] 0 keys in 1 masters.
    0.00 keys per slot on average.
    >>> Performing Cluster Check (using node 127.0.0.1:6379)
    M: 9a8dd4a7fe734cbe58196a2d380392c3064dbfe8 127.0.0.1:6379
     slots:[0-16383] (16384 slots) master
    [OK] All nodes agree about slots configuration.
    >>> Check for open slots…
    >>> Check slots coverage…
    [OK] All 16384 slots covered.

你可能感兴趣的:(Linux,redis,linux,分布式)