标签:客户端 target http done slave ade one style sla
语法 https://segmentfault.com/a/1190000002680804
启动3台redis
更改从机的masterauth密码
执行redis-server redis.conf启动redis
执行redis-cli -p 6379 [6380,6381] 进入redis客户端查看info replication信息,
运行sentinel有两种方式:
redis-sentinel /path/to/sentinel.conf
redis-server /path/to/sentinel.conf --sentinel
主从切换日志
10671:X 20 Jun 12:45:55.951 # +sdown master mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:55.951 # +odown master mymaster 127.0.0.1 6379 #quorum 1/1 10671:X 20 Jun 12:45:55.951 # +new-epoch 2 10671:X 20 Jun 12:45:55.951 # +try-failover master mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:55.954 # +vote-for-leader 0bc851c61ce22b98c9b3c7857f240721a5d6c9b5 2 10671:X 20 Jun 12:45:55.954 # +elected-leader master mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:55.954 # +failover-state-select-slave master mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:56.038 # +selected-slave slave 127.0.0.1:6381 127.0.0.1 6381 @ mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:56.038 * +failover-state-send-slaveof-noone slave 127.0.0.1:6381 127.0.0.1 6381 @ mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:56.128 * +failover-state-wait-promotion slave 127.0.0.1:6381 127.0.0.1 6381 @ mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:57.020 # +promoted-slave slave 127.0.0.1:6381 127.0.0.1 6381 @ mymaster 127.0.0.1 6379 选举6381作为新的主机 10671:X 20 Jun 12:45:57.020 # +failover-state-reconf-slaves master mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:57.080 * +slave-reconf-sent slave 127.0.0.1:6380 127.0.0.1 6380 @ mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:58.027 * +slave-reconf-inprog slave 127.0.0.1:6380 127.0.0.1 6380 @ mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:58.027 * +slave-reconf-done slave 127.0.0.1:6380 127.0.0.1 6380 @ mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:58.088 # +failover-end master mymaster 127.0.0.1 6379 10671:X 20 Jun 12:45:58.088 # +switch-master mymaster 127.0.0.1 6379 127.0.0.1 6381 切换81为新的主机 10671:X 20 Jun 12:45:58.088 * +slave slave 127.0.0.1:6380 127.0.0.1 6380 @ mymaster 127.0.0.1 6381 10671:X 20 Jun 12:45:58.088 * +slave slave 127.0.0.1:6379 127.0.0.1 6379 @ mymaster 127.0.0.1 6381 10671:X 20 Jun 12:46:01.162 # +sdown slave 127.0.0.1:6379 127.0.0.1 6379 @ mymaster 127.0.0.1 6381
标签:客户端 target http done slave ade one style sla
原文地址:https://www.cnblogs.com/eason-d/p/9203233.html