Redis高可用架构简述(2)

[root@localhost tmp]# redis-cli -h 100.10.32.54  -p 26400 info Sentinel
# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
master0:name=master6400,status=ok,address=100.10.32.54:6400,slaves=1,sentinels=3

[root@localhost tmp]# ip a |grep eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    inet 100.10.32.54/24 brd 100.10.32.255 scope global eth0
    inet 100.10.32.250/24 scope global secondary eth0

四、测试
1、把主库停掉
redis-cli -h 100.10.32.54  -p 6400 shutdown

2、看从库是否提升为主库
[root@localhost tmp]# redis-cli -h 100.10.32.55 -p 6400 info Replication
# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

3、看VIP是否漂移到100.10.32.55上
[root@localhost tmp]# ip a |grep eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    inet 100.10.32.55/24 brd 100.10.32.255 scope global eth0
    inet 100.10.32.250/24 scope global secondary eth0

4、看Sentinel的监控状态
[root@localhost tmp]# redis-cli -p 26400 info  Sentinel
# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
master0:name=master6400,status=ok,address=100.10.32.55:6400,slaves=1,sentinels=3

下面关于Redis的文章您也可能喜欢,不妨参考下:

Ubuntu 14.04下Redis安装及简单测试

Redis主从复制基本配置

CentOS 7下Redis的安装与配置

Ubuntu 14.04安装Redis与简单配置

Ubuntu 16.04环境中安装PHP7.0 Redis扩展

Redis 单机&集群离线安装部署

CentOS 7.0 安装Redis 3.2.1详细过程和使用常见问题

Ubuntu 16.04环境中安装PHP7.0 Redis扩展

Ubuntu 15.10下Redis集群部署文档

Redis实战 中文PDF

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/da23ce71eed8b058c15f395c389a2bca.html