KeepAlived—— 1.基本安装

1. 原理概述

Keepalived的作用是检测web服务器的状态,如果有一台web服务器死机或工作出现故障
Keepalived将检测到,并将有故障的web服务器从系统中剔除,当web服务器工作正常后
Keepalived自动将web服务器加入到服务器群中,这些工作全部自动完成,不需要人工干涉
需要人工做的只是修复故障的web服务器。
Layer3,4,5工作在IP/TCP协议栈的IP层,TCP层,及应用层,原理分别如下:
Layer3:Keepalived使用Layer3的方式工作式时,Keepalived会定期向服务器群中的服务器
发送一个ICMP的数据包(既我们平时用的Ping程序),如果发现某台服务的IP地址没有激活
Keepalived便报告这台服务器失效,并将它从服务器群中剔除,这种情况的典型例子是某台
服务器被非法关机。
Layer3的方式是以服务器的IP地址是否有效作为服务器工作正常与否的标准。
Layer4:如果您理解了Layer3的方式,Layer4就容易了。Layer4主要以TCP端口的状态来
定服务器工作正常与否。如web server的服务端口一般是80,如果Keepalived检测到80端
口没有启动,则Keepalived将把这台服务器从服务器群中剔除。
Layer5:Layer5就是工作在具体的应用层了,比Layer3,Layer4要复杂一点,在网络上占用
的带宽也要大一些。Keepalived将根据用户的设定检查服务器程序的运行是否正常,如果与
用户的设定不相符,则Keepalived将把服务器从服务器群中剔除。

2. 官方信息

[root@master ~]# yum info keepalived
Loaded plugins: fastestmirror
Bad id for repo: centos-paas-openshift-origin , byte =   28
Loading mirror speeds from cached hostfile
Available Packages
Name        : keepalived
Arch        : x86_64
Version     : 1.3.5
Release     : 6.el7
Size        : 329 k
Repo        : source
Summary     : Load balancer and high availability service
URL         : http://www.keepalived.org/
License     : GPLv2+
Description : Keepalived provides simple and robust facilities for load balancing
            : and high availability.  The load balancing framework relies on the
            : well-known and widely used Linux Virtual Server (IPVS) kernel module
            : providing layer-4 (transport layer) load balancing.  Keepalived
            : implements a set of checkers to dynamically and adaptively maintain
            : and manage a load balanced server pool according their health.
            : Keepalived also implements the Virtual Router Redundancy Protocol
            : (VRRPv2) to achieve high availability with director failover.

2. 安装

[root@master ~]# yum install -y  keepalived
[root@master ~]# rpm -ql keepalived
/etc/keepalived
/etc/keepalived/keepalived.conf
/etc/sysconfig/keepalived
/usr/bin/genhash
/usr/lib/systemd/system/keepalived.service
/usr/libexec/keepalived
/usr/sbin/keepalived

————Blueicex 2020/03/26 17:12 [email protected]

发布了226 篇原创文章 · 获赞 1 · 访问量 7932

猜你喜欢

转载自blog.csdn.net/blueicex2017/article/details/105123005