ipvsadm 命令积累
2015-06-29 09:10
232 查看
查看内核是否支持 ipvsadm
Conns (connections scheduled) 已经转发过的连接数
InPkts (incoming packets) 入包个数
OutPkts (outgoing packets) 出包个数
InBytes (incoming bytes) 入流量(字节)
OutBytes (outgoing bytes) 出流量(字节)
修改 LVS 表中的 fin_timeout 使用指令如下
[test@LVS ~]$ /sbin/modprobe -l|grep ipvs /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_dh.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_ftp.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_lblc.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_lblcr.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_lc.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_nq.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_rr.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_sed.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_sh.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_wlc.ko /lib/modules/2.6.18-308.el5/kernel/net/ipv4/ipvs/ip_vs_wrr.ko如果不支持,就安装 ipvsadm
yum -y install ipvsadmipvsadm 参数详解:
-C 清除表中所有的记录-A --add-service在服务器列表中新添加一条新的虚拟服务器记录-t 表示为tcp服务-u 表示为udp服务-s --scheduler 使用的调度算法, rr | wrr | lc | wlc | lblb | lblcr | dh | sh | sed | nq 默认调度算法是 wlcipvsadm -a -t 192.168.3.187:80 -r 192.168.200.10:80 -m -w 1-a --add-server 在服务器表中添加一条新的真实主机记录-t --tcp-service 说明虚拟服务器提供tcp服务-u --udp-service 说明虚拟服务器提供udp服务-r --real-server 真实服务器地址-m --masquerading 指定LVS工作模式为NAT模式-w --weight 真实服务器的权值-g --gatewaying 指定LVS工作模式为直接路由器模式(也是LVS默认的模式)-i --ipip 指定LVS的工作模式为隧道模式-p 会话保持时间,定义流量呗转到同一个realserver的会话存留时间
[test@LVS ~]$ sudo /sbin/ipvsadm -l IP Virtual Server version 1.2.1 (size=4096)Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConnTCP 192.1.17.10:http wlc -> 10.2.4.35:http Route 100 25095 18542 -> 10.2.4.31:http Route 100 25097 17657 -> 10.2.4.30:http Route 100 25123 18953 -> 10.2.4.29:http Route 100 25091 18727 -> 10.2.4.24:http Route 100 25075 17703 -> 10.2.4.23:http Route 100 25086 17465 -> 10.2.4.22:http Route 100 25124 17628
InActConn 指非活跃连接数,我们将处于 TCP ESTABLISH 状态以外的连接都称为不活跃连接。例如处于 SYN_RECV 状态的连接,处于 TIME_WAIT 状态的连接等。
[test@LVS ~]$ sudo /sbin/ipvsadm -l --rate IP Virtual Server version 1.2.1 (size=4096)Prot LocalAddress:Port CPS InPPS OutPPS InBPS OutBPS -> RemoteAddress:PortTCP 192.1.17.10:http 2438 16241 0 6385560 0 -> 10.2.4.35:http 146 965 0 372714 0 -> 10.2.4.34:http 164 1089 0 423347 0 -> 10.2.4.28:http 152 1035 0 406658 0 -> 10.2.4.27:http 157 1031 0 411744 0 -> 10.2.4.22:http 160 1078 0 425447 0 -> 10.2.4.21:http 159 1078 0 423759 0
--rate选项是显示速率信息 CPS (current connection rate) 每秒连接数 InPPS (current in packet rate) 每秒的入包个数 OutPPS (current out packet rate) 每秒的出包个数 InBPS (current in byte rate) 每秒入流量(字节) OutBPS (current out byte rate) 每秒入流量(字节)
[test@LVS ~]$ sudo /sbin/ipvsadm -l --statsIP Virtual Server version 1.2.1 (size=4096)Prot LocalAddress:Port Conns InPkts OutPkts InBytes OutBytes -> RemoteAddress:PortTCP 192.1.17.10:http 326629K 3588M 0 22517G 0 -> 10.2.4.23:http 584349K 3896M 0 1469G 0 -> 10.2.4.34:http 597422K 3956M 0 1501G 0 -> 10.2.4.28:http 631106K 4198M 0 1592G 0 -> 10.2.4.27:http 578297K 3850M 0 1459G 0 -> 10.2.4.22:http 580208K 3859M 0 1463G 0 -> 10.2.4.21:http 685758K 283146K 0 1737G 0
--stats选项是统计自该条转发规则生效以来的
Conns (connections scheduled) 已经转发过的连接数
InPkts (incoming packets) 入包个数
OutPkts (outgoing packets) 出包个数
InBytes (incoming bytes) 入流量(字节)
OutBytes (outgoing bytes) 出流量(字节)
修改 LVS 表中的 fin_timeout 使用指令如下
ipvsadm --set 900 60 300
中间的 60 就是 tcp 的 fin_timeout 时间 查看默认的值使用如下命令: $ sudo /sbin/ipvsadm -Ln --timeout Timeout (tcp tcpfin udp): 900 60 300
相关文章推荐
- 命令积累
- 欢迎使用CSDN-markdown编辑器
- JPA注解之“@GeneratedValue”详解
- .NET平台开源项目速览(7)关于NoSQL数据库LiteDB的分页查询解决过程
- map模块使用方法
- C语言常用字符串处理函数
- web app开发
- Android 动态加载(防止逆向编译)技术
- 作业6.12
- .NET平台开源项目速览(6)FluentValidation验证组件介绍与入门(一)
- 约瑟夫环问题
- Linux管理员必须知道的sudo命令
- setup github's blog
- Gradle 1.12用户指南翻译——第三十四章. JaCoCo 插件
- 《实体解析与信息质量》 - 2.2.0 总结
- Gradle 1.12用户指南翻译——第三十四章. JaCoCo 插件
- .ftl文件 是什么文件 Freemarker
- [转]加快npm的下载速度
- 【Spring学习笔记-MVC-12】Spring MVC视图解析器之ResourceBundleViewResolver
- js报错 版本问题