码迷,mamicode.com
首页 > 其他好文 > 详细

编译安装配置keepalived-2.0.17

时间:2019-07-17 00:21:01      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:mamicode   priority   info   需要   virtual   int   email   min   技术   

安装:
官网下载源码包
wget https://www.keepalived.org/software/keepalived-2.0.17.tar.gz

安装keepalived所需要的 一些依赖包
yum install openssl-devel popt-devel libnl-devel kernel-devel gcc -y

解压源码,安装到/usr/local/keepalived

tar zxvf keepalived-2.0.17.tar.gz
cd keepalived-2.0.17
 ./configure --prefix=/usr/local/keepalived
 make && make install

启动keepalived服务

systemctl enable keepalived
systemctl start keepalived

启动报错,默认读取配置文件为/etc/keepalived/keepalived.conf

mkdir -p /etc/keepalived
ln -s /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
systemctl start keepalived
systemctl status keepalived

技术图片

配置:
master:

! Configuration File for keepalived

global_defs {
   notification_email {
       admin@bluemobi.cn
   }
   notification_email_from  lvs_admin@bluemobi.cn
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id MASTER
     script_user root
   enable_script_security
}

vrrp_script check_haproxy {
   script "/etc/keepalived/scripts/check_haproxy.sh"
   interval 3
}

vrrp_instance http {
    state BACKUP
    interface eth0    
    dont_track_primary
    nopreempt

    track_interface {
    eth0
    }

    garp_master_delay 6
    virtual_router_id 60
    priority 110
    advert_int 1

    authentication {
    auth_type PASS
    autp_pass 1234
    }

    virtual_ipaddress {
    192.168.12.53/24 brd 192.168.12.255 dev eth0 label eth0:1
    }

    track_script {
    check_haproxy
    }

    notify_master /etc/keepalived/scripts/state_master.sh
    notify_backup /etc/keepalived/scripts/state_backup.sh
    notify_fault  /etc/keepalived/scripts/state_fault.sh
}

backup:

! Configuration File for keepalived

global_defs {
   notification_email {
       admin@bluemobi.cn
   }
   notification_email_from  lvs_admin@bluemobi.cn
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id BACKUP
     script_user root
   enable_script_security
}

vrrp_script check_haproxy {
   script "/etc/keepalived/scripts/check_haproxy.sh"
   interval 3
}

vrrp_instance http {
    state BACKUP
    interface eth0    
    dont_track_primary
    nopreempt

    track_interface {
    eth0
    }

    garp_master_delay 6
    virtual_router_id 60
    priority 105
    advert_int 1

    authentication {
    auth_type PASS
    autp_pass 1234
    }

    virtual_ipaddress {
    192.168.12.53/24 brd 192.168.12.255 dev eth0 label eth0:1
    }

    track_script {
    check_haproxy
    }

    notify_master /etc/keepalived/scripts/state_master.sh
    notify_backup /etc/keepalived/scripts/state_backup.sh
    notify_fault  /etc/keepalived/scripts/state_fault.sh
}

编译安装配置keepalived-2.0.17

标签:mamicode   priority   info   需要   virtual   int   email   min   技术   

原文地址:https://blog.51cto.com/7585527/2420737

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!