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

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

LVS+keepalived+httpd高可用集群

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

Web服務器:192.168.80.102
                    192.168.80.103

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

LVS+keepalived+httpd高可用集群

蒙自ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!

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                          //進入keepalived刪除所有內(nèi)容并添加以下內(nèi)容:

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

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

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

LVS+keepalived+httpd高可用集群


在80.101虛擬機上:
systemctl stop firewalld           //關閉防火墻
setenforce 0                            //關閉監(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/              //進入目錄
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/            //進入目錄
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      //設置權限
./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      //關閉httpd
在頁面上刷新成下面情況:

LVS+keepalived+httpd高可用集群


標題名稱:LVS+keepalived+httpd高可用集群
標題來源:http://weahome.cn/article/ggpjep.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部