Introduction to Linux clusters and Lvs-nat deployment (i)

Source: Internet
Author: User
Tags time 0

With the continuous development of a company, the number of users increases, the load capacity requirements of the server is also increasing, can take the swap high-performance server to solve the load capacity problem, which is called scaling up. However, the extended hardware will eventually reach a limit, and the load requirements will not be met at this time. And the exchange of high-performance server investment and improve the level of load capacity is not a cost-effective, it is possible to invest a large sum of money for only about 20% load capacity improvement. So with the concept of cluster (Cluster), that is, the collection of computers, multiple servers through the dispatch of the front-end scheduler to provide users with services, that is, scaling out.
Linux cluster is divided into several types: LB, HA, HP, ds,lb is load balancing, multiple servers provide services at the same time, there is a scheduler in the cluster, which is the core of the load Balancing cluster is also a point of the problem, once the scheduler problems, there will be a single point of failure, So the scheduler becomes a performance bottleneck; Ha is known as a highly available cluster, where MTBF (mean time to failure) and MTTR (mean time to repair) and availability=mtbf/(MTBF+MTTR) are the concept, and once we tend to make MTTR time 0, Cluster high availability will be good, for different business, the availability requirements are different, generally reduce mttr to improve availability; HP is called a high-performance cluster, centralizing the computing power of multiple servers to complete certain computing operations; DS is known as distributed systems, and distributed storage and distributed processing use this service more often.
LVS clusters are divided into four types: Lvs-nat,lvs-dr,lvs-tunnal,lvs-fullnat, the first three types are the results of Mr. Zhangwensong's research, Lvs-fullnat is a cluster type developed later, Generally more use of Lvs-nat and LVS-DR these two types of cluster to complete the deployment of cluster services, the following is the working diagram of the Lvs-nat cluster:

650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/20/05a03598fcd4190e79f0c01168df1f93.png "title=" lvs- Nat.png "alt=" 05a03598fcd4190e79f0c01168df1f93.png "/>

The client sends a request message on the dispatch server, when the source IP address and destination IP address are CIP and VIP respectively, the VIP network card of the dispatch server receives the message, passes it to the input chain, matches the rule on the chain, and if it matches the corresponding service, it is transmitted through the DIP network card to the back-end RS service, At this time the source IP address and the destination IP address are CIP and RIP, and the back end RS receives the message request to provide the service. Note here that the backend RS server should be a private IP address in order to prevent direct access by the extranet user, and can only be dispatched to the RS server via vs. So you need to configure a gateway to dip in Rs. Since the request message and the response packet of this cluster type need to be forwarded by the dispatcher, the request message is only dozens of bytes, and the response message is much more than dozens of bytes, so the scheduler becomes the bottleneck of the whole cluster performance and can cause a single point of failure.

Configure and test a lvs-nat cluster below:

Plan two RS are located 192.168.100.0/24 network segment, vs Medium 172.16.0.0/16 Network segment receive message, 192.168.100.0/24 network segment and RS Exchange.

First configure the IP addresses of the two RS:

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/20/ba6ca55ef4c84162d5f994f9f81d66a4.png-wh_500x0-wm_3 -wmp_4-s_3412947021.png "style=" Float:none; "title=" Rs1.png "alt=" Ba6ca55ef4c84162d5f994f9f81d66a4.png-wh_ "/>

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/20/d53c14491d0b20d0672d7065bad17381.png-wh_500x0-wm_3 -wmp_4-s_850180237.png "style=" Float:none; "title=" Rs2.png "alt=" D53c14491d0b20d0672d7065bad17381.png-wh_ "/>

Build APACHE/HTTPD Service on two RS, RS1 monitor 8080 ports, RS2 Monitor 80 ports:

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201710/20/d02e4a620083716c587d57fa94433333.png-wh_500x0-wm_3 -wmp_4-s_3855584872.png "style=" Float:none; "title=" RS1 monitor 8080 port "alt=" D02e4a620083716c587d57fa94433333.png-wh_ "/ >

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201710/20/a4fb664afd171e3783ee70ef5e3b9654.png-wh_500x0-wm_3 -wmp_4-s_1256117660.png "style=" Float:none; "title=" RS2 Monitor 80 port "alt=" A4fb664afd171e3783ee70ef5e3b9654.png-wh_ "/ >

Note: Each RS also requires a gateway to respond to the message:

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/20/79662a5325907e4427b5f1769046cff2.png-wh_500x0-wm_3 -wmp_4-s_1249880859.png "title=" Tim20171020124656.png "alt=" 79662a5325907e4427b5f1769046cff2.png-wh_ "/>

When you configure VS, you first configure the VS in the two NIC IP:

650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/20/53e69b27cc9a439955dd5ccf57407ea0.png "title=" VS Ip.png "alt=" 53e69b27cc9a439955dd5ccf57407ea0.png "/>

Next configure the Cluster service for VS:

650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/20/0ab0502d645995462dc7596c7691bb5f.png "title=" Cluster service. png "alt=" 0ab0502d645995462dc7596c7691bb5f.png "/>650) this.width=650; src=" https://s1.51cto.com/oss/ 201710/20/dfc32b779d71d793dbbd9722cccc955f.png "title=" Tim20171020125236.png "alt=" Dfc32b779d71d793dbbd9722cccc955f.png "/>

At this time has completed the Lvs-nat cluster, but may 172.16.0.0/16 network segment and can not access the backend server Rs,vs obviously has received the message, but did not forward, then need to open the Linux kernel Ip_forward module. There are two ways to open: Temporarily open the/proc/sys/net/ipv4/ip_forward file to save the value of 1, permanently open is the/etc/sysctl.conf in the net.ipv4.ip_forward= 0 change to Net.ipv4.ip_forward=1.

Next, test the RR algorithm used to build the Lvs-nat cluster:

650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/20/128913778f9284a6e6aed33374f42cbd.png "title=" test. png "alt=" 128913778f9284a6e6aed33374f42cbd.png "/>


Introduction to Linux clusters and Lvs-nat deployment (i)

Related Article

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.