• redis5.0 集群卡槽混乱解决方案


    简介:搭建的3主6从redis集群,运行中突然不能访问了,查看集群状态正常,查看集群节点发现卡槽混乱(见下图),具体原因还不清楚(有哪位大佬可以解释下)。

     解决方案

      如图可见三个主节点分片都属于混乱状态,任选一个节点(我选择的7009)把其他俩个节点(7002,7008)卡槽全部转移过来,然后再重新分配到三个节点上。

    操作步骤:

    #重新分片10.9.103.214:7002为任意集群节点

    redis-cli --cluster reshard 10.9.103.214:7002 -a xxx密码xxx

    #问移动多少,你需要移动的节点有多少卡槽填多少,全部移走
    How many slots do you want to move (from 1 to 16384)? 5460
    #问接收节点ID是什么,填接收所有卡槽的ID

    What is the receiving node ID? 0c363e54338f4a04e9c05ae1a20ad33d0b15a965

    #输入要迁移的ID,输入完none结束
    Please enter all the source node IDs.
    Type 'all' to use all the nodes as source nodes for the hash slots.
    Type 'done' once you entered all the source nodes IDs.

    Source node #1: e6625283e2a67b35aa7c86081437484ec29e0efe
    Source node #1:done

    #问是否确认

    输入:yes

    #重复操作,把另一个节点也转移过去。

    #转移完毕后,8009分配了所有卡槽,重新再平衡

    redis-cli --cluster rebalance 10.7.38.14:7009 --cluster-use-empty-masters -a  xxx密码xxx

    #提示报错[ERR] Nodes don’t agree about configuration,重新识别下。

    redis-cli -p 7009 cluster meet 10.7.38.14 7008 -a   xxx密码xxx
    redis-cli -p 7009 cluster meet 10.9.103.214 7002 -a   xxx密码xxx
    

    #查看主从集群关系

     #恢复下主从关系,删除2个重复节点,再选择主节点添加

     删除节点

    10.9.103.170:7005为任意节点,f0d8d85522211e07fc4a60aeb14d433fc5288c9f为要删除节点的ID
    redis-cli --cluster del-node 10.9.103.170:7005 f0d8d85522211e07fc4a60aeb14d433fc5288c9f -a xxx密码xxx

    添加节点

    10.7.38.14:7007添加的节点,10.9.103.170:7005任意节点,e6625283e2a67b35aa7c86081437484ec29e0efe主节点ID
    redis-cli --cluster add-node 10.7.38.14:7007 10.9.103.170:7005 --cluster-slave --cluster-master-id e6625283e2a67b35aa7c86081437484ec29e0efe -a xxx密码xxx

    #查看服务连接redis是否正常。

  • 相关阅读:
    Linux
    python中元类
    POJ 1182 食物链
    POJ 1733 Parity game
    top 介绍
    周记 2014.8.31
    windows10配置python
    oracle执行update时卡死问题的解决办法
    An Easy Introduction to CUDA C and C++
    super()
  • 原文地址:https://www.cnblogs.com/chenjiye/p/16253099.html
Copyright © 2020-2023  润新知