Eric @ EricBess WebHome

Thinking blindly without action, it will be unknowingly become meaningless

Chinese (Simplified) flagItalian flagKorean flagPortuguese flagEnglish flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag
By N2H

Using mod_rewrite load balanced

APACHE mode_rewrite reading documents, referred to rewrite a number of methods used to achieve a balanced load method, recorded.

Load balanced

Description:

How to balance www.foo.com load to www[0-5].foo.com (a total of 6 servers)?

Program:

This issue there are many possible solutions, in this, we discussed commonly known as "Based on DNS (DNS-based) of" programs, and special use mod_rewrite program:

  1. DNS cycle (DNS Round-Robin)

    The easiest way is to use BIND cyclical nature of the DNS, as long as the customary set up www[0-9].foo.com the DNS of the A (address) records, such as:

      www0 IN A 1.2.3.1 
      www1 IN A 1.2.3.2 
      www2 IN A 1.2.3.3 
      www3 IN A 1.2.3.4 
      www4 IN A 1.2.3.5 
      www5 IN A 1.2.3.6 
    

    Then, increase the following:

      www IN CNAME www0.foo.com. 
             IN CNAME www1.foo.com. 
             IN CNAME www2.foo.com. 
             IN CNAME www3.foo.com. 
             IN CNAME www4.foo.com. 
             IN CNAME www5.foo.com. 
             IN CNAME www6.foo.com. 
    

    Note that the above may seem wrong, but in fact, it is indeed a BIND a desired characteristics, but also can be used. In any case, now www.foo.com has been analytical, BIND can be given www0-www6 - although each time there will be minor in order replacement / cycle, the client's request can be distributed to each server. However, this is not a good load-balancing program, because, DNS analytical information can be other name server network buffer, and once www.foo.com be resolved for wwwN.foo.com while its follow-up request will be sent to www.foo.com But the final result is correct, because the total amount of the request was indeed distributed to each server

Click to continue reading

July 5th, 2008 Posted by eric | System | no comments