sentinel发起failover命令,slave切换成master的过程

sentinel发起failover命令
sentinelFailoverStateMachine
    sentinelFailoverSelectSlave

日志:
2837:X 27 Jul 2020 10:45:09.636 # +selected-slave slave 192.168.27.128:6479 192.168.27.128 6479 @ mymaster 192.168.27.128 6379
2837:X 27 Jul 2020 10:45:09.636 * +failover-state-send-slaveof-noone slave 192.168.27.128:6479 192.168.27.128 6479 @ mymaster 192.168.27.128 6379
2837:X 27 Jul 2020 10:45:09.703 * +failover-state-wait-promotion slave 192.168.27.128:6479 192.168.27.128 6479 @ mymaster 192.168.27.128 6379

slave收到信息,设置当前配置信息为master相关
    {"slaveof",replicaofCommand,3,
     "admin no-script ok-stale",
     0,NULL,0,0,0,0,0,0},
void replicaofCommand(client *c)
    ##
        /* The special host/port combination "NO" "ONE" turns the instance
     * into a master. Otherwise the new master address is set. */
    if (!strcasecmp(c->argv[1]->ptr,"no") &&
        !strcasecmp(c->argv[2]->ptr,"one")) {
        if (server.masterhost) {
            replicationUnsetMaster();
            sds client = catClientInfoString(sdsempty(),c);
            serverLog(LL_NOTICE,"MASTER MODE enabled (user request from '%s')",
                client);
            sdsfree(client);
        }
日志:
2811:M 27 Jul 2020 10:45:09.704 # Setting secondary replication ID to 53800b91899d420c81b7c170c03e63cbfa378cb7, valid up to offset: 18684. New replication ID is 710727bc0c2596d189135eea774afe10da43d22b
2811:M 27 Jul 2020 10:45:09.704 * Discarding previously cached master state.
2811:M 27 Jul 2020 10:45:09.704 * MASTER MODE enabled (user request from 'id=16 addr=192.168.27.128:58900 fd=15 name=sentinel-97661441-cmd age=59 idle=0 flags=x db=0 sub=0 psub=0 multi=3 qbuf=140 qbuf-free=32628 obl=36 oll=0 omem=0 events=r cmd=exec')
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值