负载均衡
笔记
官方资料:http://www.nginx.cn/doc/standard/httpupstream.html
使用反向代理实现负载均衡。
upstream <名字> { server ip:port; server ip:port; server ip:port; ... } location / { proxy_pass http://<名字>; }
负载均衡策略
1)轮询(默认)
2)weight:权重
3)ip_hash: 同一个ip客户端请求交给同一个服务器。
4)fair: 根据响应时间转发请求。
5)url_hash: 同一个url请求交给同一个服务器。
====================================================================
- 加权轮训
2)检查nginx配置后重载服务
/usr/sbin/nginx -t systemctl reload nginx netstat -tnulp | grep nginx
====================================================================
- ip_hash
2)检查nginx配置后重载服务
/usr/sbin/nginx -t systemctl reload nginx netstat -tnulp | grep nginx
转载于//www.cnblogs.com/oklizz/p/11336421.html
还没有评论,来说两句吧...