真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

LVS+keepalived+httpd高可用集群-創(chuàng)新互聯(lián)

環(huán)境:
主keepalived服務(wù)器:192.168.80.100
從keepalived服務(wù)器:   192.168.80.101

Web服務(wù)器:192.168.80.102
                    192.168.80.103

在80.100虛擬機上:
systemctl stop firewalld           //關(guān)閉防火墻
setenforce 0                            //關(guān)閉監(jiān)控
yum install lrz* -y       //安裝上傳軟件
把keepalived包拉入

LVS+keepalived+httpd高可用集群

成都創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站設(shè)計、網(wǎng)站制作與策劃設(shè)計,廊坊網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)十多年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:廊坊等地區(qū)。廊坊做網(wǎng)站價格咨詢:13518219792
tar xf keepalived-1.4.2.tar.gz -C /opt/       //解壓keepalived-1.4.2文件到/opt
cd /opt/keepalived-1.4.2/
yum install gcc gcc-c++ make popt-devel kernel-devel openssl-devel -y
./configure --prefix=/
make && make install
cd /
cd /etc/
ls | grep keepalived
cd keepalived/

LVS+keepalived+httpd高可用集群

vi keepalived.conf                          //進(jìn)入keepalived刪除所有內(nèi)容并添加以下內(nèi)容:

! Configuration File for keepalived
global_defs {
   router_id LVS_01            //本服務(wù)器的名稱
}
vrrp_instance VI_1 {            //定義VRRP熱備實例
    state MASTER             //熱備狀態(tài),MASTER表示主服務(wù)器,BACKUP表示從服務(wù)器
    interface ens32            //承載VIP地址的物理接口
    virtual_router_id 51        //虛擬路由器的ID號,每個熱備組保持一致
    priority 110               //優(yōu)先級,數(shù)值越大優(yōu)先級越高
    advert_int 1               //通告間隔秒數(shù)(心跳頻率)
    authentication {            //熱備認(rèn)證信息,每個熱備組保持一致
        auth_type PASS        //認(rèn)證類型
        auth_pass 6666        //密碼字符串
    }
    virtual_ipaddress {          //指定漂移地址(VIP),可以有多個
        192.168.80.188
    }
}
virtual_server 192.168.80.188 80 {      //虛擬服務(wù)器地址(VIP)、端口
        delay_loop 6               //健康檢查的間隔時間(秒)
        lb_algo rr                  //輪詢(rr)調(diào)度算法
        lb_kind DR                 //直接路由(DR)群集工作模式
        persistence_timeout 60       //連接保持時間(秒)
        protocol TCP                //應(yīng)用服務(wù)器采用的是TCP協(xié)議
real_server 192.168.80.102 80 {         //第一個Web服務(wù)器節(jié)點的地址、端口
        weight 1                   //節(jié)點的權(quán)重
        TCP_CHECK {                //健康檢查方式
        connect_port 80             //檢查的目標(biāo)端口
        connect_timeout 3           //連接超時(秒)
        nb_get_retry 3              //連接超時(秒)
        delay_before_retry 3          //重試間隔
        }
}
real_server 192.168.80.103 80 {           //第二個Web服務(wù)器節(jié)點的地址、端口
        weight 1                                     //節(jié)點的權(quán)重
        TCP_CHECK {                            //健康檢查方式
             connect_port 80                    //檢查的目標(biāo)端口
             connect_timeout 3                 //連接超時(秒)
             nb_get_retry 3                       //連接超時(秒)
             delay_before_retry 3               //重試間隔
     }
  }
}

   :wq        //保存退出
service keepalived start
systemctl status keepalived      //查看keepalived狀態(tài)

LVS+keepalived+httpd高可用集群

ip addr show dev ens32
LVS+keepalived+httpd高可用集群

modprobe ip_vs
yum install ipvsadm -y
service keepalived restart
ipvsadm -Ln            //查看LVS虛擬服務(wù)器

LVS+keepalived+httpd高可用集群


在80.101虛擬機上:
systemctl stop firewalld           //關(guān)閉防火墻
setenforce 0                            //關(guān)閉監(jiān)控
yum install lrz* -y       //安裝上傳軟件
把keepalived包拉入

LVS+keepalived+httpd高可用集群

tar xf keepalived-1.4.2.tar.gz -C /opt/       //解壓keepalived-1.4.2文件到/opt
cd /opt/keepalived-1.4.2/
yum install gcc gcc-c++ make popt-devel kernel-devel openssl-devel -y
./configure --prefix=/
make && make install
modprobe ip_vs
yum install ipvsadm -y
vi /etc/keepalived/keepalived.conf            //刪除所有內(nèi)容并添加以下內(nèi)容:

! Configuration File for keepalived
global_defs {
   router_id LVS_02
}
vrrp_instance VI_1 {
    state BACKUP
    interface ens32
    virtual_router_id 51
    priority 105
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 6666
    }
    virtual_ipaddress {
        192.168.80.188
    }
}
virtual_server 192.168.80.188 80 {
        delay_loop 6
        lb_algo rr
        lb_kind DR
        persistence_timeout 60
        protocol TCP
real_server 192.168.80.102 80 {
        weight 1
        TCP_CHECK {
        connect_port 80
        connect_timeout 3
        nb_get_retry 3
        delay_before_retry 3
        }
}
real_server 192.168.80.103 80 {
        weight 1
        TCP_CHECK {
             connect_port 80
             connect_timeout 3
             nb_get_retry 3
             delay_before_retry 3
     }
  }
}

   :wq       //保存退出
service keepalived start
systemctl status keepalived           //查看keepalived狀態(tài)

LVS+keepalived+httpd高可用集群

————————————————————————————

在80.102虛擬機上:
systemctl stop firewalld
setenforce 0
yum install httpd -y                  //安裝httpd
vi /etc/httpd/conf/httpd.conf
ServerName   www.example.com.80  前面的#去掉

LVS+keepalived+httpd高可用集群

cd /var/www/html/              //進(jìn)入目錄
echo "

SERVER AA

" > index.html //在index.html添加內(nèi)容 ls cat index.html

LVS+keepalived+httpd高可用集群

systemctl start httpd
cd
ls
./web.sh

LVS+keepalived+httpd高可用集群

ifconfig //查找IP地址
LVS+keepalived+httpd高可用集群


在虛擬機80.103上:
systemctl stop firewalld
setenforce 0

yum install httpd -y //安裝httpd

vi /etc/httpd/conf/httpd.conf
ServerName   www.example.com.80 前面的#去掉

LVS+keepalived+httpd高可用集群

cd /var/www/html/            //進(jìn)入目錄
echo "

SERVER BB

" > index.html //在index.html添加內(nèi)容 ls cat index.html

LVS+keepalived+httpd高可用集群

systemctl start httpd
vi web.sh      
里面添加以下內(nèi)容
#!/bin/bash
#haha
ifconfig lo:0 192.168.80.188 broadcast 192.168.80.188 netmask 255.255.255.255 up
route add -host 192.168.80.188 dev lo:0
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
sysctl -p &>/dev/null

    :wq       //保存退出
chmod +x web.sh      //設(shè)置權(quán)限
./web.sh
ifconfig          //查找IP地址

LVS+keepalived+httpd高可用集群

scp web.sh root@192.168.80.102:/root/     //把地址傳送過去
yes
root密碼

LVS+keepalived+httpd高可用集群

網(wǎng)頁上輸入http:192.168.80.188

LVS+keepalived+httpd高可用集群

在80.103中
systemctl stop httpd      //關(guān)閉httpd
在頁面上刷新成下面情況:

LVS+keepalived+httpd高可用集群

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


當(dāng)前文章:LVS+keepalived+httpd高可用集群-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://weahome.cn/article/jhdsp.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部