一、lvs工作在哪层(新浪面试题)
http://blog.chinaunix.net/uid-346158-id-2131163.html
二、四层、七层负载均衡的区别
所谓四层就是基于IP+端口的负载均衡;七层就是基于URL等应用层信息的负载均衡;同理,还有基于MAC地址的二层负载均衡和基于IP地址的三层负载均衡。 换句换说,二层负载均衡会通过一个虚拟MAC地址接收请求,然后再分配到真实的MAC地址;三层负载均衡会通过一个虚拟IP地址接收请求,然后再分配到真实的IP地址;四层通过虚拟IP+端口接收请求,然后再分配到真实的服务器;七层通过虚拟的URL或主机名接收请求,然后再分配到真实的服务器。
三、Nginx、LVS及HAProxy负载均衡软件的优缺点
http://www.jianshu.com/p/fa937b8e6712(更详细的解释)
四、lvs(高性能原因)
淘宝开发了VS/FULLNAT,从本质上来说也是基于网络地址转换技术。最近还有一个基于VS/FULLNAT的DNAT模块。
不管使用哪种机制,LVS都不直接处理请求,而是将请求转发到后面真正的服务器(Real Server)。不同的机制,决定了响应包如何返回到客户端。
五、HAProxy:在不影响现有连接的情况下,重新加载配置
使用haproxy的-sf(finished) 参数,可以方便重启了:
haproxy -f configfile -sf
haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)
推荐的方法:今天在 Ubuntu 上,发现 /etc/init.d/haproxy 中已经有现成的命令了:
sudo /etc/init.d/haproxy reload|force-reload
Reference:
http://blog.sina.com.cn/s/blog_6262a50e0101e8a3.html
http://www.codeceo.com/haproxy-reload.html
六、haproxy1.8版本之前reload必须得重启
<1>有两种重启方式.1.硬重启,即强制关闭连接 2.软重启,即等现有连接处理完后重启
HAProxy supports a graceful and a hard stop. The hard stop is simple, when the
SIGTERM signal is sent to the haproxy process, it immediately quits and all
established connections are closed. The graceful stop is triggered when the
SIGUSR1 signal is sent to the haproxy process. It consists in only unbinding
from listening ports, but continue to process existing connections until they
close. Once the last connection is closed, the process leaves. The hard stop method is used for the "stop" or "restart" actions of the service
management script. The graceful stop is used for the "reload" action which
tries to seamlessly reload a new configuration in a new process. Both of these signals may be sent by the new haproxy process itself during a
reload or restart, so that they are sent at the latest possible moment and only
if absolutely required. This is what is performed by the "-st" (hard) and "-sf"
(graceful) options respectively. #Reference:https://www.haproxy.org/download/1.6/doc/management.txt
<2>1.8版本之后支持无缝重启
参考:
https://www.haproxy.com/blog/truly-seamless-reloads-with-haproxy-no-more-hacks/
http://www.haproxy.org/ #待测试