Server Load balancer-Configuration)

Source: Internet
Author: User

Guest string: hacker form artifacts, database issues

Recommendation: Teach you how to create a keyword matching project (search engine) ---- the first day (start point), and the first day (search engine) ---- 19th days (latest)

Object-oriented Sublimation: object-oriented cognition-new first cognition, object-oriented imagination-sleepwalking (1), object-oriented cognition-how to find a class

 

Similar articles: Server Load balancer-Concepts


Tucao: since the article "discussing Server Load balancer" was swallowed up by the blog, my mind is extremely unbalanced. I want to change the name to "Server Load balancer-Concepts and concepts ", add several more articles to explain the essence of the previous article.

I do not know about Server Load balancer yet. I suggest you read: Server Load balancer-Concepts

 

----------- The beginning of the gorgeous split line ---------------

 

First, let's review the concepts in the previous article:Server Load balancer = separation capability.

Since we need to have the ability to separate ourselves, this is easy to do, just get a few more servers.
The example we are talking about today ..... Let's take a look at the figure first:



The figure is clear. I will use aliases as follows:

PA: Server Load balancer/Web Entry Server/www.mydomain.com P1: Web server/separation 1/192.168.2.3 P2: Web server/separation 2/192.168.2.4 P3: Web server/separation 3/192.168.2.5

 

PS: Before we start learning this, we recommend that you close the firewalls of PA, P1, P2, and P3, and try not to cause unnecessary troubles.

First of all: Pa, P1, P2, P3 are installed with nginx, will not install can go to the official website to view the Tutorial: http://www.nginx.cn/install (Chinese Version of the tutorial, very ox X)

1. After installation, find the nginx. conf configuration file of PA:
Add the following code to the HTTP segment:

upstream servers.mydomain.com {     server 192.168.2.3:80;     server 192.168.2.4:80;     server 192.168.2.5:80;}

Of course, servers.mydomain.com can be retrieved at will.

The server configuration of PA is as follows:
Add the following code to the HTTP segment:

server{     listen 80;     server_name www.mydomain.com;     location / {         proxy_pass http://servers.mydomain.com;         proxy_set_header Host $host;         proxy_set_header X-Real-IP $remote_addr;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;     } }    

The configurations of P1, P2, and P3 are as follows:

server{     listen 80;     server_name www.mydomain.com;     index index.html;     root /data/htdocs/www; }

 

2. Someone asked me, but I can't use other ports. Of course, this is also acceptable. Suppose the nginx. conf configuration file of PA:

upstream servers2.mydomain.com {     server 192.168.2.3:8080;     server 192.168.2.4:8081;     server 192.168.2.5:8082;}server{     listen 80;     server_name www.mydomain.com;     location / {         proxy_pass http://servers2.mydomain.com;         proxy_set_header Host $host;         proxy_set_header X-Real-IP $remote_addr;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;     } }

 

The P1 configuration is as follows:

server{     listen 8080;     server_name www.mydomain.com;     index index.html;     root /data/htdocs/www; }

 

P2 Configuration:

server{     listen 8081;     server_name www.mydomain.com;     index index.html;     root /data/htdocs/www; }

 

P3 Configuration:

server{     listen 8082;     server_name www.mydomain.com;     index index.html;     root /data/htdocs/www; }

 

After the restart, we can access it. Well, it's really amazing.
When we shut down a server.
Visit the URL, or OK. Note:Server Load balancer also needs to know how to fix him (T picking camp)

 

3. How does Server Load balancer keep the call?
Of course, there are several solutions available now. This time we will only talk about one.
IP hash Policy
Advantage: it is better to allocate multiple requests from the same client to the same server for processing, avoiding the need that Weighted Round Robin cannot be applied to session persistence.
Disadvantage: when there are many requests from a certain IP address at a certain time point, the pressure on a backend server may be very high, while other backend servers may be idle and unbalanced.


If you want to be more impressed, I have a blog post here. We recommend that you take a look at it:
Http://blog.csdn.net/xiajun07061225/article/details/9334477


Nginx configuration is also very simple, the Code is as follows:

upstream servers2.mydomain.com {     server 192.168.2.3:8080;     server 192.168.2.4:8081;     server 192.168.2.5:8082;    ip_hash;}

 

In fact, everything is so simple. Come and try it!

4. Have you found a problem with so many servers? Where are the files they need?
To learn how to solve the problem, please continue with the following:Server Load balancer-File Service Policy

Server Load balancer-Configuration)

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.