Nginx's upstream centralized distribution mode

Source: Internet
Author: User

First, distribution mode

1. Polling method (default)

Upstream Realserver {server 192.168.1.1; Server 192.168.1.2;}

Each request is assigned in chronological order to a different server on the backend, and if a server goes down, the server is automatically rejected.

2.weight weights

Upstream Realserver {server 192.168.1.1 weight=5; Server 192.168.1.2 weight=8;}

depending on the performance of the backend server, the probability of being accessed is set, the higher the number, the greater the chance.

3.ip_hash

Upstream Realserver {ip_hash;        Server 192.168.1.1; Server 192.168.1.2;}

This enables a fixed IP to access a backend server, which can effectively solve the user session problem.

4.fair (third Party)

Upstream Realserver {server 192.168.1.1;        Server 192.168.1.2; Fair;}

Allocation of requests According to the response speed of the backend server, with short response times prioritized

5.url_hash (third Party)

Upstream Realserver {server 192.168.1.1;        Server 192.168.1.2;        Hash $request _uri; Hash_method CRC32;}

According to the hash result of the URL to allocate the request, so that each URL address request to the same back-end server, the back-end server for the cache server is more effective. Parameters such as weight cannot be used at this time

Second, the equipment status

Down : Indicates that the device is in a deactivated state

Backup: Indicates that the device is a standby device and is assigned to the request only if all devices except him are down or busy.

Weight: Represents a weight, the greater the value, the greater the chance of being requested.

Max_fails and fail_timeout are generally used for association, Max_fails sets the number of times a request fails to be allowed, by default 1. Fail_timeout sets the number of times the request failed n times after which the service is no longer requested, the default is 10s.

Nginx's upstream centralized distribution mode

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.