What is keepalived, keepalived the name known, keep alive, in the network is to remain online, which is called high availability or hot standby, to prevent a single point of failure (single point of failure is that once a point of failure will lead to the entire system architecture is not available), When it comes to keepalived have to say that a protocol is VRRP agreement, can be said that this agreement is the basis for keepalived implementation, then first we look at the VRRP agreement
One, the principle of keepalived
1,VRRP protocol
Friends who have studied the network know that the network must be designed to take into account the redundancy disaster, including line redundancy, equipment redundancy, and so on, to prevent a single point of failure of the network, that in the router or three-tier switch to achieve redundancy is particularly important, in the network there is a protocol to do this, this agreement is VRRP Agreement, Keepalived is a clever use of VRRP protocol to achieve high availability (HA)
2,keepalived is also modular design, different modules complex different functions, the following is the keepalived components
Core Check VRRP LIBIPFWC libipvs-2.4 libipvs-2.6
Core: It is the kernel of keepalived, the startup and maintenance of complex main process, the load parsing of global configuration file, etc.
Check: Responsible for Healthchecker (health check), including a variety of health screening methods, and corresponding configuration analysis including LVS configuration analysis
VRRP:VRRPD subprocess, VRRPD process is to implement the VRRP protocol
Libipfwc:iptables (ipchains) library, configuration LVs will use
libipvs*: The configuration LVs will use
Note that keepalived and LVs are totally different things, but they accountability with each other.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/zs/
There will be three processes after keepalived starts
Parent process: Memory management, child process management, etc.
Subprocess: VRRP Child process
Subprocess: Healthchecker Child process
There is a figure that two sub processes are watchdog by the system, two of the child processes of their own complex, healthchecker process complex check the health of their servers, such as HTTP,LVS, etc. If the Healthchecker process checks that the service is not available on master, it notifies the sibling on this computer VRRP the child process, lets him delete the notification, and removes the virtual IP and converts it to the backup state
Second, keepalived installation
[Root@test1 ~]# wget http://www.keepalived.org/software/keepalived-1.2.1.tar.gz
[root@test1 ~]# tar zxvf keepalived-1.2.1.tar.gz
[root@test1 ~]# cd keepalived-1.2.1
[Root@test1 keepalived-1.2.1]#./configure-- Prefix=/usr/local/keepalived
[root@test1 keepalived-1.2.1]# make && make install
installation error:
1,
CONFIGURE:ERROR:
!!! OpenSSL is isn't properly installed on your system. !!!
!!! Can not include OpenSSL headers files. !!!
WORKAROUND: [Root@test1 keepalived-1.2.1]# yum install-y openssl-devel
2, use
Ipvs Framework : No
Ipvs Sync Daemon Support:no
Here is not necessary, but it is recommended that you install
[root@test1 keepalived-1.2.1]# cd/usr/src/kernels/
[ Root@test1 kernels]# Yum install-y kernel-devel ipvsadm [root@test1-~]# ln-s/usr/src/kernels/2.6.18-194.el5-x86_
64/ /usr/src/linux