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]

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章