Linux下Keepalived 安裝與配置

Keepalived 安裝與配置html

 

1、環境說明linux

 

一、操做系統內核版本:2.6.9-78.ELsmp瀏覽器

    2Keepalived軟件版本:keepalived-1.1.20.tar.gz服務器

 

2、環境配置測試

 

1、主Keepalived服務器IP地址 192.168.111.223url

2、備Keepalived服務器IP地址  192.168.111.100spa

3Keepalived虛擬IP地址  192.168.111.150操作系統

 

3、軟件下載地址3d

 

      http://www.keepalived.org/software/keepalived-1.1.20.tar.gzhtm

 

4、安裝流程

 

   1、上傳Keepalived/home/目錄

    2、解壓Keepalived軟件

      [root@localhost home]# tar -zxvf keepalived-1.1.20.tar.gz 

      [root@localhost home]# cd keepalived-1.1.20

      [root@localhost keepalived-1.1.20]# ln -s /usr/src/kernels/2.6.9-78.EL-i686/usr/src//linux

      [root@localhost keepalived-1.1.20]# ./configure 

   3、提示

          Linux下Keepalived <wbr>安裝與配置

   4、編譯以及編譯安裝

      [root@localhost keepalived-1.1.20]# make && make install

Linux下Keepalived <wbr>安裝與配置

      5、將types.h調用的部分註釋掉便可解決4出現的問題

     vi/usr/src/kernels/2.6.9-78.EL-i686/include/linux/types.h 

     到158行操做以下

     

   #endif 

    

    

 6、從新編譯以及編譯安裝

     [root@localhost keepalived-1.1.20]# make && make install

       Linux下Keepalived <wbr>安裝與配置

   

   7修改配置文件路徑

       [root@localhostkeepalived-1.1.20]#cp/usr/local/etc/rc.d/init.d/keepalived/etc/rc.d/init.d/

       [root@localhostkeepalived-1.1.20]# cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/

       [root@localhost keepalived-1.1.20]# mkdir /etc/keepalived

       [root@localhostkeepalived-1.1.20]#cp /usr/local/etc/keepalived/keepalived.conf/etc/keepalived/                           

       [root@localhost keepalived-1.1.20]# cp /usr/local/sbin/keepalived /usr/sbin/

   8、設置爲服務,開機啓動

       [root@localhost keepalived-1.1.20]# vi /etc/rc.local 

       Linux下Keepalived <wbr>安裝與配置



 

5、主Keepalived配置

 

     1、修改配置文件

        [root@localhost keepalived-1.1.20]# vi /etc/keepalived/keepalived.conf 

       Linux下Keepalived <wbr>安裝與配置

6、備Keepalived配置

 

       1、修改配置文件

       Linux下Keepalived <wbr>安裝與配置

 

7、啓動服務

    Linux下Keepalived <wbr>安裝與配置

     

8、查看網卡信息

 1、主Keepalived網卡信息

Linux下Keepalived <wbr>安裝與配置

 

9、驗證測試

 

 1、在主服務器上新建一個網頁,內容爲 192.168.111.223

 2、在備用服務器上新建一個網頁,內容爲 192.168.111.100

 3、啓動主備服務器的http服務和Keepalived服務

 4、經過瀏覽數,輸入虛擬IP地址 192.168.111.150

        頁面顯示爲 192.168.111.223

5、關閉主服務器的Keepalived服務,經過瀏覽器輸入IP地址192.168.111.150

        頁面顯示爲 192.168.111.100

6、再次啓動主服務器的Keepalived服務,經過瀏覽器輸入IP地址192.168.111.150

        頁面顯示爲 192.168.111.223

相關文章
相關標籤/搜索