开发者社区 问答 正文

在redis集群中,若主节点出现故障,如何让子节点成为主节点?

在redis集群中,如果主节点出现故障,怎么让子节点成为主节点??

展开
收起
落地花开啦 2016-02-19 15:34:16 3209 分享 版权
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人

    刚查了一下,在redis.conf文件中,有这样一段话:
    # The slave priority is an integer number published by Redis in the INFO output.
    # It is used by Redis Sentinel in order to select a slave to promote into a
    # master if the master is no longer working correctly.
    #
    # A slave with a low priority number is considered better for promotion, so
    # for instance if there are three slaves with priority 10, 100, 25 Sentinel will
    # pick the one wtih priority 10, that is the lowest.
    #
    # However a special priority of 0 marks the slave as not able to perform the
    # role of master, so a slave with priority of 0 will never be selected by
    # Redis Sentinel for promotion.
    #
    # By default the priority is 100.
    slave-priority 100
    大致意思就是通过设置从节点的优先级,来决定从节点是否能扮演主节点的角色。优先级是0的将不会成为主节点

    2019-07-17 18:44:48
    赞同 展开评论