Nginx powerful Web server, or reverse proxy server, and Nginx can also follow the schedule rules to achieve dynamic, static page separation, you can follow the polling, IP hash, url hash, weight and other ways to load balance the back-end server, but also support the health check of the backend server.
Nginx's upstream supports 5 load balancing methods:
1), polling (default)
Each request is assigned to a different back-end server in chronological order, and can be automatically rejected if the backend server is down.
2), Weight
Specifies the polling probability, proportional to the weight and access ratios, for situations where the performance of the backend server is uneven.
3), Ip_hash
Each request is allocated according to the hash result of the access IP, so that each visitor has fixed access to a back-end server that resolves the session issue.
4), Fair (third party)
The response time of the back-end server is allocated to the request, and the response time is short of priority allocation.
5), Url_hash (third party)
Simulation Scenario:
Two Web services (TOMCAT1 and TOMCAT2) were launched in CentOS
Native ip:192.168.33.195
TOMCAT1 Native: 192.168.33.192 Port: 8080
TOMCAT2 Native: 192.168.33.193 Port: 8080
Then modify the conf configuration file for the Nginx service to achieve the most basic load balancing
Note: Location inside to configure the site name Proxy_pass points to the upstream configuration
Enter Nginx's IP access as follows:
Nginx load Balancing in CentOS