安装keepalived
会遇到的问题
checking for openssl/ssl.h... no
configure: error:
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL headers files. !!!
在下一篇解决 【安装openssl】
开始安装
[root@node1 ~]# wget http://www.keepalived.org/software/keepalived-1.2.13.tar.gz
[root@node1 ~]# tar zxvf keepalived-1.2.13.tar.gz
[root@node1 keepalived-1.2.13]# cd keepalived-1.2.13
[root@node1 keepalived-1.2.13]# ./configure --prefix=/usr/local/keepalived --disable-fwmark
[root@node1 keepalived-1.2.13]# make
[root@node1 keepalived-1.2.13]# make install
[root@node1 keepalived-1.2.13]# cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
[root@node1 keepalived-1.2.13]# cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
[root@node1 keepalived-1.2.13]# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
[root@node1 keepalived-1.2.13]# cd /etc/init.d/
[root@node1 init.d]# chkconfig --add keepalived
[root@node1 init.d]# chkconfig keepalived on
[root@node1 init.d]# mkdir -p /etc/keepalived
#vi /etc/keepalived/keepalived.conf
global_defs {
notification_email {
xnyan@meihuichina.com
}
notification_email_from 705123846@qq.com
smtp_server 127.0.0.1
stmp_connect_timeout 30
router_id id_1
}
vrrp_sync_groups vg1 {
group {
v_211
}
}
vrrp_instance v_211 {
state MASTER
interface eth0
virtual_router_id 51
mcast_src_ip 192.168.123.238
priority 101 #权值
advert_int 1 #默认检查时间
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress { #虚拟ip地址
192.168.123.238
}
}
[root@node1 haproxy]# service keepalived start
Starting keepalived: [ OK ]
查看日志
cd /etc/keepalived/
tail
-f
/var/log/messages
[root@node1 sbin]# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:c5:66:52 brd ff:ff:ff:ff:ff:ff
inet 192.168.228.156/24 brd 192.168.228.255 scope global eth0
inet6 fe80::20c:29ff:fec5:6652/64 scope link
valid_lft forever preferred_lft forever