Virtual Server implementation method (Dynamic Balancing)

Source: Internet
Author: User
Article Title: virtual server implementation (Dynamic Balancing ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Virtual Server: it is a single external portal, and many computers serve it internally. for those who use it, it is a machine with a single entry point. there are two specific implementation technologies: the virtual server at the application layer and the virtual server at the network layer.
  
1. The virtual server at the application layer is implemented using the forwarding at the application layer, which is equivalent to a proxy server, which is often referred to as a virtual server.
  
Implementation Method: apache's ProxyPass can be used to configure the virtual server (in httpd. conf)
  
If a company's WWW server is a http://www.abc.com/make the following settings in httpd. conf:
  
ProxyPass/sales http: // 192.168.0.1/
ProxyPass/rd http: // 192.168.0.2/
ProxyPass/head http: // 192.168.0.3/
  
After the above settings take effect, the requests for ingress. For http://www.abc.com/headwill be forwarded to http://192.168.0.2. the customer will not directly interact with 192.168.0.x, and all requests will be forwarded through www.abc.com.
  
The process is as follows:
  
Client (http://www.abc.com/sales) <--> www.abc.com <--> 192.168.0.1
  
2. The virtual server on the ip layer is implemented by Reverse masq on the ip layer.
  
Implementation Method: rewrite the destination ip address of the ip address header. the ip port forward in linux kernel 2.2.x is implemented. you need a management tool to manage this method. this method is also called reverse NAT.
  
Setting method:
  
1. In kernel compilation, select ip_port_forward (??)
  
2. Use ipmasqadm to set ip_port_forward.
  
Ipmasqadm-A www.abc.com: 80-R 192.168.0.1: 80
  
For more information, see man.
  
Ipmasqadm-A www.abc.com: 80-R 192.168.0.2: 80
  
3. Set ipchains
  
Ipchains-A forward-j MASQ-s 192.168.0.0/24
  
Ipchains-A forward-j MASQ-d 192.168.0.0/24
  
4. OK ..
  
Test:
  
(1) Now you visit http://www.abc.com/
  
(2) The IP package you visit is sent to www.abc.com and the target address is changed to 192.168.0.x. If x is 1 or 2, it can be selected by the system's load balancing algorithm.
  
(3) After processing, the request packet is sent back to www.abc.com and then sent back to the customer.
  
In this way, the machine can be expanded ..... the load on your www server is too large. Both of the above methods can be used. the load on your telnet server is too large. You can use method 2.
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.