1, achieve the effect
(1) the browser address bar enter the address http://192.168.17.129/edu/a.html, load balancing effect, an average of 8080 and 8081 in the port
2. Preparation
(1) Prepare two Tomcat servers, one 8080 and one 8081
(2) In the two Tomcat webapps directories, create a folder named edu, create page A.HTML in the edu folder for testing
3. Configure load balancing in the nginx configuration file
Nginx allocates server policies
First polling (default)
Each request is allocated to a different backend server one by one in chronological order. If the backend server goes down, the request is automatically removed.
The second kind of weight
Weight indicates that the default weight is 1. The higher the weight is, the more clients can be assigned
The third ip_hash
Each request is allocated based on the hash result of the access IP, so that each visitor has fixed access to one back-end server
Type 4 Fair (third Party)
Requests are allocated based on the response time of the back-end server, with priority given to those with short response times.