• Redis+Keepalived


    简介

    Redis高可用方案,保障两台Redis任意节点故障可正常使用。

    方案:Redis主从复制+Redis哨兵+Keepalived

    环境

    系统:Centos/Radhat 7

    服务1:Redis 3.2.12

    服务2:Keepalived 1.3.5

    服务器数量:两台

    主:192.168.1.151

    备:192.168.1.152

    VIP:192.168.1.153

    部署

    Redis:主从复制+哨兵:https://www.cnblogs.com/xiangsikai/p/11995552.html

    安装 Keepalived

    1、主备服务器同时安装通过yum安装Keepalived

    yum -y install keepalived

    配置 Keepalived

    1、主:配置Keepalived 配置文件

    vim /etc/keepalived/keepalived.conf

    global_defs {
       router_id Redis-HA
    }
    vrrp_instance VI_1 {
    state BACKUP
    interface eno16777728
    virtual_router_id 51
    priority 200
    advert_int 1
    nopreempt
    authentication {
    auth_type PASS
    auth_pass 1111
    }
    
    virtual_ipaddress {
    192.168.1.153
    }
    }
    
    virtual_server 192.168.1.153 6379 {
    delay_loop 2
    protocol TCP
    real_server 192.168.1.151 6379 {
    notify_down /redis.sh
    TCP_CHECK {
    connect_timeout 3
    nb_get_retry 3
    delay_before_retry 3
      }
    }
    }
    主配置文件

    2、备:配置Keepalived配置文件

    vim /etc/keepalived/keepalived.conf

    global_defs {
       router_id Redis-HA
    }
    vrrp_instance VI_1 {
    state BACKUP
    interface eno16777728
    virtual_router_id 51
    priority 190
    advert_int 1
    authentication {
    auth_type PASS
    auth_pass 1111
    }
    virtual_ipaddress {
    192.168.1.153
    }
    }
    
    virtual_server 192.168.1.153 6379 {
    delay_loop 2
    protocol TCP
    real_server 192.168.1.150 6379 {
    notify_down /redis.sh
    TCP_CHECK {
    connect_timeout 3
    nb_get_retry 3
    delay_before_retry 3
      }
    }
    }
    从配置文件

    3、主备:创建执行脚本并加入权限

    vim /redis.sh

    #!/bin/bash
    pkill keepalived
    脚本
    chmod +x /redis.sh

    4、主备:启动Keepalived服务。

    注:Redis Master 端优先启动获取VIP

    systemctl start keepalived
    systemctl enable keepalived

    5、查看vip

    ip a
  • 相关阅读:
    Tabs 选项卡插件(续)
    Menu 菜单插件
    jquery Star Rating - 星形评级插件
    Tabs 选项卡插件
    jQuery Tooltips插件
    jQuery信息提示插件(jQuery Tooltip Plugin)
    Accordion 手风琴 折叠菜单插件
    Calendars 日历插件
    Microsoft Windows 2000 professional(集成SP4)简体中文专业版下载
    俄罗斯商务资讯网(门户网站)
  • 原文地址:https://www.cnblogs.com/xiangsikai/p/12054476.html
Copyright © 2020-2023  润新知