20210304. 0.2. Redis 哨兵模式搭建 - 拉勾教育

搭建主从 Redis

  • 主机:192.168.181.133:6379
  • 从机:192.168.181.132:6379

搭建 Sentinel

  1. 安装

    make install PREFIX=/redis/sentinel
    cp /etc/redis/6379.conf /redis/sentinel/bin/
    
    
  2. 修改配置文件 sentinel.conf

    daemonize yes
    sentinel monitor mymaster 192.168.181.133 6379 1
    
  3. 启动 Sentinel

    /redis/sentinel/bin/redis-sentinel sentinel.conf
    
  4. 测试哨兵功能

    1. 关闭 133 主机,一段时间后,通过 info replication 命令查看 132 状态转变为主机
    2. 重启 133 主机,一段时间后,通过 info replication 命令查看 133 状态转变为从机
posted @ 2021-03-04 15:10  流星<。)#)))≦  阅读(46)  评论(0编辑  收藏  举报