lvs-net之單主機基於連接埠調度

來源:互聯網
上載者:User

標籤:lvs-net

實驗環境:centos 7

實驗程式:httpd、ipvsadm

實驗目的:在單台主機上用lvs做httpd基於連接埠的調度

IP 連接埠 首頁
10.1.12.13 80 This is www1
10.1.12.13 81 This is www2
10.1.12.13 82 This is www3

一、安裝httpd並配置三個虛擬機器主機

[[email protected] conf.d]# vi vhost.conf

<VirtualHost *:80>        ServerName www.blackCao.com        DocumentRoot "/vhost/www1"    <Directory "/vhost/www1">        Options none        AllowOverride none        Require all granted    </Directory>        CustomLog logs/www1_access.log combined        ErrorLog logs/www1_erroe.log</VirtualHost>##<VirtualHost *:81>        ServerName www.blackCao.com        DocumentRoot "/vhost/www2"    <Directory "/vhost/www2">        Options none        AllowOverride none        Require all granted    </Directory>        CustomLog logs/www2_access.log combined        ErrorLog logs/www2_erroe.log</VirtualHost>##<VirtualHost *:82>        ServerName www.blackCao.com        DocumentRoot "/vhost/www3"    <Directory "/vhost/www3">        Options none        AllowOverride none        Require all granted    </Directory>        CustomLog logs/www3_access.log combined        ErrorLog logs/www3_erroe.log</VirtualHost>

[[email protected] conf.d]# vi ../conf/httpd.conf

Listen 81Listen 82Listen 80

二、安裝ipvsadm並配置

[[email protected] ~]# yum install -y ipvsadm
[[email protected] ~]# ipvsadm -A -t 10.1.12.13:80 -s rr[[email protected] ~]# ipvsadm -a -t 10.1.12.13:80 -r 10.1.12.13:80 -m[[email protected] ~]# ipvsadm -a -t 10.1.12.13:80 -r 10.1.12.13:81 -m[[email protected] ~]# ipvsadm -a -t 10.1.12.13:80 -r 10.1.12.13:82 -m[[email protected] ~]# ipvsadm -L -n  -> RemoteAddress:Port           Forward Weight ActiveConn InActConnTCP  10.1.12.13:80 rr  -> 10.1.12.13:80                Masq    1      0          0           -> 10.1.12.13:81                Masq    1      0          0           -> 10.1.12.13:82                Masq    1      0          0

三、測試

啟動http服務並查看連接埠監聽狀態,在別的虛擬機器主機上使用curl命令測試,是否為三個首頁檔案輪詢調度。在瀏覽器上測試一般會有緩衝,所以還是別踩坑了

本文出自 “傳說中的豬” 部落格,請務必保留此出處http://cszdz.blog.51cto.com/11892760/1879672

lvs-net之單主機基於連接埠調度

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.