Keepalived安裝

一、準備

系統

CentOS7 最小化安裝。html

下載
文件 下載地址 介紹
keepalived http://www.keepalived.org/download.html keepalived-1.2.23.tar.gz

Keepalived詳細介紹簡介linux

二、安裝

依賴安裝
yum -y install gcc gcc-c++ gcc-g77 ncurses-devel bison libaio-devel  openssl openssl-devel
解壓安裝
tar -zxvf keepalived-1.2.23.tar.gz 
./configure  --prefix=/usr/local/keepalived --sysconf=/etc
make
make install
ln -s /usr/local/keepalived/sbin/keepalived /sbin/

#若是/etc/init.d文件夾下沒有keepalived執行
cp /usr/local/src/keepalived-1.2.23/keepalived/etc/init.d/keepalived.init /etc/init.d/keepalived
chkconfig --add keepalived
chkconfig keepalived on

#中止
service keepalived stop
#啓動
service keepalived start
#重啓
service keepalived restart

啓動後
c++

三、簡單測試

修改keepalived.conf網絡

vi /etc/keepalived/keepalived.conf

配置以下測試

! Configuration File for keepalived

vrrp_instance VI_1 {
    state MASTER # master_server
    interface eth0
    virtual_router_id 51
    priority 100 # 權重值,值大的優先級高
    advert_int 2 # 檢測時間間隔2s
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.1.6.220 # VIP(網絡內未使用過的,已使用的沒法綁定)
    }
}

網絡內未使用10.1.6.220地址。
.net

配置完成後重啓keepalived服務,虛擬IP(10.1.6.220)已經綁定成功,能ping通。
rest

四、以前的嘗試

嘗試yum v1.2.13

yum install keepalived(v1.2.13)方式安裝後能正常,可是命令關閉後啓動沒法補全。code

嘗試V1.3.5

安裝keepalived-1.3.5能安裝成功並啓動,可是使用service keepalived stop沒法中止服務。
http://siliang.blog.51cto.com/5882215/1918485router

嘗試v1.3.1

下降版本至安裝出現server

nclude/vrrp_iproute.h:32:24: 致命錯誤:linux/mpls.h:沒有那個文件或目錄
 #include <linux/mpls.h>

http://blog.csdn.net/lipeigang1109/article/details/54912696

相關文章
相關標籤/搜索