Callout: This article belongs to the original content of Ant class, other website reprint must mark source and Ant class. Www.itmayiedu.com
1.1 What is load balancing
web
650) this.width=650; "Src=" http://www.itmayiedu.com/images/upload/ueditor/image/20170104/1483519667003048949. PNG "style=" margin:0px Auto;padding:0px;border:0px;vertical-align:baseline;background:transparent;height:auto; " alt= "1483519667003048949.png"/>
1.2 Demand
Nginx as a load balancer server, the user requests to arrive firstNginx, and then byNginxforwarding requests to a load configurationTomcatserver.
In the real world, Nginx and Tomcat servers are separate.
1.3 Add a local domain name to the host file
127.0.0.1 www.itmayiedu.com
1.4 Configuring Nginx Load Balancing
650) this.width=650; "Src=" http://www.itmayiedu.com/images/upload/ueditor/image/20170104/1483519667050046703.png "Style=" margin:0px auto;padding:0px;border:0px;vertical-align:baseline;background:transparent;height:auto; "alt= "1483519667050046703.png"/>
1.5 Configure weight for load Balancing
650) this.width=650; "Src=" http://www.itmayiedu.com/images/upload/ueditor/image/20170104/1483519667205089000.png "Style=" margin:0px auto;padding:0px;border:0px;vertical-align:baseline;background:transparent;height:auto; "alt= "1483519667205089000.png"/>
Using weight to configure load balancing, the weight defaults to 1, and the higher the weight, the more requests are processed.
node Description: added in the HTTP node: #定义负载均衡设备的 IP and device status upstream myServer { Server 127.0.0.1:9090 down; Server 127.0.0.1:8080 weight=2; server 127.0.0.1:6060; Server 127.0.0.1:7070 BACKUP;&NBSP } Add Proxy_pass http://myServer under the server node that needs to use the payload; Upstream the status of each device: down indicates that the server before the single is temporarily not participating in load Weight The larger the default is 1.weight, the greater the load weight. Max_fails: The number of times a request fails is defaulted to 1. Returns the error defined by the Proxy_next_upstream module when the maximum number of times is exceeded; Fail_timeout:max_fails Times failed, The time of the pause. Backup: When all other non-backup machines are down or busy, request the backup machine. So the pressure on this machine is the lightest. |
1.6
650) this.width=650; "Src=" http://www.itmayiedu.com/images/upload/ueditor/image/20170104/1483519667237005015.png "Style=" margin:0px auto;padding:0px;border:0px;vertical-align:baseline;background:transparent;height:auto; "alt= "1483519667237005015.png"/>
650) this.width=650; "Src=" http://www.itmayiedu.com/images/upload/ueditor/image/20170104/1483519667454054911.png "Style=" margin:0px auto;padding:0px;border:0px;vertical-align:baseline;background:transparent;height:auto; "alt= "1483519667454054911.png"/>
Address bad input: Www.itmayiedu.com through the nginx server load balancer, randomly forwarded to 8080 server or 8082 server.
This article is from "Ant classroom" blog, please make sure to keep this source http://itmayiedu.blog.51cto.com/6234756/1889008
Using Nginx+tomcat load Balancing