Configure a simple Web lb cluster with LVs

Source: Internet
Author: User

Knowledge Reserve:

Ipvsadm:

Managing Cluster Services

Added:-a-t|u|f service-address [-S scheduler]

Clusters of-T:TCP protocols

Clusters of-U:UDP protocols

-F:FWM: Firewall tag

Service-address:ip:port

Modification:-e

Delete:-d-t|u|f service-address

Managing the RS in the Cluster service

Added:-a-t|u|f service-address-r server-address [-g|i|m] [-w weight]

-t|u|f service-address: A pre-defined Cluster service

-R server-address: The address of an RS , in the NAT model, you can use the IP: Port to implement ports mapping;

[-g|i|m]: LVs type

-g:dr

-i:tun

-m:nat

[-W Weight]: Define server weights

Modification:-e

Delete:-d-t|u|f service-address-r server-address

View

-l|l

-N: Number format displays host address and port

--stats: Statistical data

--rate: Rate

--timeout: Shows the session timeout length for TCP,Tcpfin , and UDP

-C: Show current Ipvs connection Status

Remove all cluster services

-C: Empty the ipvs rule

Save Rule

Service Ipvsadm Save

Or:

-S

# ipvsadm-s >/path/to/somefile

Load the previous rule:

-R

# Ipvsadm-r </path/form/somefile

Prepare :

three linux virtual machine: rs1 , rs2 , dr , can be on the Internet and configured yun Source, rs2 Install yum install         -y httpd ), DR Install

(yum install-y ipvsadm).

IP address planning:RS1:192.168.10.8 255.255.255.0 Gateway 192.168.10.7

RS2:192.168.10.9 255.255.255.0 Gateway 192.168.10.7

DR:eth0:192.168.10.7 255.255.255.0

eth1:192.168.0.2 255.255.255.0 192.168.0.1

Practices :

1. Change the eth0 NIC connection mode of the three hosts to the host mode only,the DR 's eth1 to the bridge mode, the base site planning configuration corresponds to the IP , so that three virtual machine network interoperability

2. In order to show the effect, we provide different Web pages on two RS respectively

: echo " fsy. RS1  >/var/www/html/index.html

: echo " fsy. RS2  >/var/www/html/index.html

3. start the Web service on RS1 and RS2 and test it (you can try to shut down the firewall and SELinux if you have problems with the process )

RS1: #service httpd start

#curl http://192.168.10.8

#curl http://192.168.10.9

RS2: #service httpd start

#curl http://192.168.10.8

#curl http://192.168.10.9

4. test on DR

#curl http://192.168.10.8

#curl http://192.168.10.9

5. Configure on DR (write Ipvs rule) after all normal testing

# ipvsadm-a-T 192.168.0.2:80-s RR

# ipvsadm-a-T 192.168.0.2:80-r 192.168.10.8-m

# ipvsadm-a-T 192.168.0.2:80-r 192.168.10.9-m

# IPVSADM-L-N View

6. Turn on and turn off the firewall between network cards

# echo 1 >/proc/sys/net/ipv4/ip_forward

#service iptables Stop

7. Open the browser for access testing.

As I expected, everything is fine!




This article is from the "10917734" blog, please be sure to keep this source http://10927734.blog.51cto.com/10917734/1826932

Configure a simple Web lb cluster with LVs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.