keepalived安装配置

安装:

tar -zvxf keepalived-1.3.2.tar.gz 

cd keepalived-1.3.2

./configure

make && make install

cp /usr/local/src/keepalived-1.3.2/keepalived/etc/init.d/keepalived /etc/rc.d/init.d/

cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/

mkdir /etc/keepalived

cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/

cp /usr/local/sbin/keepalived /usr/sbin/

将nginx和keepalive服务加入开机启动服务

echo "/etc/init.d/keepalived start" >> /etc/rc.local

配置:

主配置:

[root@mano-ha-dev-1 ~]# cat /etc/keepalived/keepalived.conf

! Configuration File for keepalived

global_defs {

router_id mano-ha-dev-1.novalocal

vrrp_mcast_group4 224.0.0.3

}

vrrp_instance VI_1 {

state BACKUP

interface eth0

virtual_router_id 123

priority 100

nopreempt

advert_int 1

authentication {

auth_type PASS

auth_pass 1111

}

virtual_ipaddress {

192.168.205.108/24

}

notify_master "/opt/guest-ha/bin/ha-notify MASTER &"

notify_backup "/opt/guest-ha/bin/ha-notify SLAVE &"

}

备配置:

[root@mano-ha-dev-2 ~]# cat /etc/keepalived/keepalived.conf

! Configuration File for keepalived

global_defs {

router_id mano-ha-dev-2.novalocal

vrrp_mcast_group4 224.0.0.3

}

vrrp_instance VI_1 {

state BACKUP

interface eth0

virtual_router_id 123

priority 90

advert_int 1

authentication {

auth_type PASS

auth_pass 1111

}

virtual_ipaddress {

192.168.205.108/24

}

notify_master "/opt/guest-ha/bin/ha-notify MASTER &"

notify_backup "/opt/guest-ha/bin/ha-notify SLAVE &"

}

你可能感兴趣的:(keepalived安装配置)