一、什么是负载均衡
负载均衡,顾名思义是指将负载尽量均衡的分摊到多个不同的服务器,以保证服务的可用性和可靠性,提供给客户更好的用户体验;
负载均衡的直接目标就是尽量发挥多个服务单元的整体效能,要实现这个目标就要有有好的选路策略,这也是负载均衡的重点;
nginx提供了较多的负载均衡策略:加权轮询、IP哈希、fair、一致哈希,前2个是官方源码内置的策略,主要还是要学习前两个:加权轮询、IP哈希
二、负载均衡策略
如果不做任何多余的配置,那么nginx默认是采用加权轮询的策略;
如果要采用IP哈希策略,就必须在nginx的配置文件里通过配置指令ip_hash明确指定(ip_hash指令必须放在server前面)
今天写不完了,下次继续
深入剖析nginx
http://www.keydatas.com/html/nginx.html?audience=320658
以上两处结合,继续写完