Posted by 曹宇伟 on 十一月 12th, 2008
今天集群中的一个App节点因为程序错误(我称之为撞车,系统的负载能力跟高速公路的车辆通行能力很相似,可以类比)导致系统负载急剧增加,直至没有响应,挂掉了。
本来按照预计,挂掉的节点应该在6秒钟内权值(weight)被自动降为零。然后等了一分钟,也没有被降权,立刻意识到,nanny遇到了我之前做监按、写监控经常遇到的问题,超时问题。
nanny在App高负载的情况下迟迟得不到应答(不知道进行到了哪一步),不知怎么办是好了。
在配置文件里明明是有timeout配置的,不知道为什么没有生效,看来到目前为止,我们的LVS集群,还是不能完全无人值守的,占个位置,等待新的研究结果:
………………
Posted by 曹宇伟 on 九月 15th, 2008
食人鱼(Piranha)是南美洲食肉的淡水鱼。它们通常15—25厘米(6—10英寸)长,虽然有时发现有长度达到40厘米的。食人鱼具有尖利的牙齿(能够轻易咬断用钢造的鱼钩或是一个人的手指[1]),非常凶猛,一旦发现猎物,往往群起而攻之。可以10分鐘內將一隻活牛吃剩一排白骨。当地人用它们的牙齿来做工具和武器。亚马逊河、圭亚那河、巴拉圭河、等河流是食人鱼经常出没的场所。

piranha,水虎鱼,食人鱼

piranha,水虎鱼,食人鱼
piranha:
Summary : Cluster administation tools
Description : Various tools to administer and configure the Linux Virtual Server as well as heartbeating and failover components. The LVS is a dynamically adjusted kernel routing mechanism that provides load balancing primarily for web and ftp servers though other services are supported.
piranha的组件:
/usr/sbin/pulse
heartbeating daemon for monitoring the health of cluster nodes.
/usr/sbin/lvsd
daemon to control the Red Hat clustering services.
/usr/sbin/nanny
tool to monitor status of service in a cluster.
/usr/sbin/fos
failover services daemon to control the Red Hat clustering service.
/usr/sbin/send_arp
tool to notify network of a new IP address / MAC address mapping.
这个工具非常有用。之前有一篇《send_arp的一个角本》,我曾经简单介绍过。
On LVS router, there are three service which need to be set to activate at boot time.
If you are clustering multi-port services or using firewall marks, you must enable the iptables service.
Posted by 曹宇伟 on 四月 11th, 2008
1. LVS调度的最小单位是“连接”。
2. 当apache的KeepAlive被设置成Off时,“连接”才能被较均衡的调度。
3. 在不指定-p参数时,LVS才真正以“连接”为单位按“权值”调度流量。
4. 在指定了-p参数时,则一个client在一定时间内,将会被调度到同一台RS。(曾经发生过蜘蛛来抓取的时候,几乎所有的请求都调度到一台RS上)
5. 可以通过”ipvsadm –set tcp tcpfin udp”来调整TCP和UDP的超时,让连接淘汰得快一些。
6. 在NAT模式时,RS的PORT参数才有意义。
7. DR和TUN模式时,InActConn 是没有意义的(Thus the count in the InActConn column for LVS-DR, LVS-Tun is inferred rather than real.)
Posted by 曹宇伟 on 八月 16th, 2007
由 wensong 在 周四, 2006-02-16 19:05 提交 对ipvsadm 的命令参考,并根据自己使用的经验,进行了一个简单的翻译,希望对ipvsadm 的使用者有一定的帮助。
为了更好的让大家理解这份命令手册,将手册里面用到的几个术语先简单的介绍一下:
1,virtual-service-address:是指虚拟服务器的ip 地址
2,real-service-address:是指真实服务器的ip 地址
3,scheduler:调度方法
(lna@networksbase.com 翻译 ipvsadm v1.21 2004 年4 月)
ipvsadm 的用法和格式如下:
ipvsadm -A|E -t|u|f virutal-service-address:port [-s scheduler] [-p
[timeout]] [-M netmask]
ipvsadm -D -t|u|f virtual-service-address
ipvsadm -C
ipvsadm -R
ipvsadm -S [-n]
ipvsadm -a|e -t|u|f service-address:port -r real-server-address:port
[-g|i|m] [-w weight]
ipvsadm -d -t|u|f service-address -r server-address
ipvsadm -L|l [options]
ipvsadm -Z [-t|u|f service-address]
ipvsadm –set tcp tcpfin udp
ipvsadm –start-daemon state [--mcast-interface interface]
ipvsadm –stop-daemon
ipvsadm -h
命令选项解释:
有两种命令选项格式,长的和短的,具有相同的意思。在实际使用时,两种都可以。
-A –add-service 在内核的虚拟服务器表中添加一条新的虚拟服务器记录。也就是增加一台新的虚拟服务器。
-E –edit-service 编辑内核虚拟服务器表中的一条虚拟服务器记录。
-D –delete-service 删除内核虚拟服务器表中的一条虚拟服务器记录。
-C –clear 清除内核虚拟服务器表中的所有记录。
-R –restore 恢复虚拟服务器规则
-S –save 保存虚拟服务器规则,输出为-R 选项可读的格式
-a –add-server 在内核虚拟服务器表的一条记录里添加一条新的真实服务器记录。也就是在一个虚拟服务器中增加一台新的真实服务器
-e –edit-server 编辑一条虚拟服务器记录中的某条真实服务器记录
-d –delete-server 删除一条虚拟服务器记录中的某条真实服务器记录
-L|-l –list 显示内核虚拟服务器表
-Z –zero 虚拟服务表计数器清零(清空当前的连接数量等)
–set tcp tcpfin udp 设置连接超时值
–start-daemon 启动同步守护进程。他后面可以是master 或backup,用来说明LVS Router 是master 或是backup。在这个功能上也可以采用keepalived 的VRRP 功能。
–stop-daemon 停止同步守护进程
-h –help 显示帮助信息
其他的选项:
-t –tcp-service service-address 说明虚拟服务器提供的是tcp 的服务
[vip:port] or
-u –udp-service service-address 说明虚拟服务器提供的是udp 的服务
[vip:port] or
-f –fwmark-service fwmark 说明是经过iptables 标记过的服务类型。
-s –scheduler scheduler 使用的调度算法,有这样几个选项
rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,
默认的调度算法是: wlc.
-p –persistent [timeout] 持久稳固的服务。这个选项的意思是来自同一个客户的多次请求,将被同一台真实的服务器处理。timeout 的默认值为300 秒。
-M –netmask netmask persistent granularity mask
-r –real-server server-address 真实的服务器
-g –gatewaying 指定LVS 的工作模式为直接路由模式(也是LVS 默认的模式)
-i –ipip 指定LVS 的工作模式为隧道模式
-m –masquerading 指定LVS 的工作模式为NAT 模式
-w –weight weight 真实服务器的权值
–mcast-interface interface 指定组播的同步接口
-c –connection 显示LVS 目前的连接 如:ipvsadm -L -c
–timeout 显示tcp tcpfin udp 的timeout 值 如:ipvsadm -L –timeout
–daemon 显示同步守护进程状态
–stats 显示统计信息
–rate 显示速率信息
–sort 对虚拟服务器和真实服务器排序输出
–numeric -n 输出IP 地址和端口的数字形式
Recent Comments