Linux-Nginx simple Load Balancing (1), linux-nginx
Here we will perform simple nginx load first, and we will not talk about nginx installation here. We assume that nginx has been installed:
1) check whether the upstrea Server Load balancer module in nginx is installed by default. Go to the nginx source code directory.
./configure --help|grep upstrea
You can see:
2) Go To The conf directory and filter the configuration file to make it clearer.
egrep -v "#|^$" nginx.conf.default > nginx.conf
3) view the Server Load balancer Module Instructions.
http://nginx.org/en/docs/http/ngx_http_upstream_module.html
4) view the document and find the example:
5) configure the configuration file in vim nginx. conf.
Upstream backend {server 183.2.174.245: 22 max_fails = 3 fail_timeout = 30 s; # ensure that the two ip addresses are accessible to server 121.201.108.43: 22 max_fails = 3 fail_timeout = 30 s; # ensure that these two ip addresses are accessible}
Note:
6) Continue Configuration:
Add to the server label # Use the polling Algorithm for load by default
proxy_pass http://http_backend;
7) Restart nginx
8) Round Robin
For n in 'seq 100 '; local ip address of the dorcurl; sleep 2; done
If you use a domain name, go to the host to configure it.
The following describes how to share sessions in Server Load balancer.
Good information:
Http://baidutech.blog.51cto.com/4114344/1033718/ parsing nginx Load Balancing