设为首页 加入收藏

TOP

你需要了解的高可用方案之使用keepalived搭建双机热备一览(二)
2019-09-17 18:52:47 】 浏览:78
Tags:需要 了解 可用 方案 使用 keepalived 搭建 双机热 一览
t-prototypes -Wextra -g -O2 -fPIE -D_GNU_SOURCE Linker flags : -pie Extra Lib : -lcrypto -lssl Use IPVS Framework : Yes IPVS use libnl : No IPVS syncd attributes : No IPVS 64 bit stats : No fwmark socket support : Yes Use VRRP Framework : Yes Use VRRP VMAC : Yes Use VRRP authentication : Yes With ip rules/routes : Yes SNMP vrrp support : No SNMP checker support : No SNMP RFCv2 support : No SNMP RFCv3 support : No DBUS support : No SHA1 support : No Use Debug flags : No smtp-alert debugging : No Use Json output : No Stacktrace support : No Memory alloc check : No libnl version : None Use IPv4 devconf : No Use libiptc : No Use libipset : No init type : systemd Build genhash : Yes Build documentation : No

 

4. 安装好了之后,在/usr/app/keepalived/etc/keepalived目录下有一个keepalived.conf文件,现在你要做的事情就是

    将它copy到/etc/keepalived文件夹下就可以了。

1 [root@localhost keepalived]# ls
2 keepalived.conf  samples
3 [root@localhost keepalived]# pwd
4 /usr/app/keepalived/etc/keepalived
5 [root@localhost keepalived]# mkdir -p /etc/keepalived
6 [root@localhost keepalived]# cp ./keepalived.conf /etc/keepalived/keepalived.conf

 

5. 接下来我们改一下配置文件。

   在192.168.23.156机器中的配置文件,修改如下:

【原来】

global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
   vrrp_skip_check_adv_addr
   vrrp_strict
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.200.16
        192.168.200.17
        192.168.200.18
    }
}

 

【修改】

global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id NodeA
   vrrp_skip_check_adv_addr
   vrrp_strict
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state MASTER
    interface ens33
    virtual_router_id 51
    priority 150
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress { 192.168.2.200 }
}

其中要注意的就是:

  《1》priority 150

     节点的优先级,master要比slave高。

  《2》interface ens33

     ens33大家可以通过ipconfig查看一下自己的网卡。

[root@localhost ~]# ifconfig
br-11757db6abf5: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.22.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        ether 02:42:c2:e0:52:10  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-875e3c64ec79: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.23.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        ether 02:42:4e:43:5b:a0  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-904f2c62861e: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.19.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        ether 02:42:6d:80:36:58  txqueuelen 0  (Ethernet)
首页 上一页 1 2 3 4 下一页 尾页 2/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇java Activiti6.0 后台 框架 spri.. 下一篇阿里架构师,讲述基于微服务的软..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目