ipvsadm命令的用法
(1)管理集群服务
  添加:-A -t|u|f service-address [-s scheduler]
                   -t:TCP协议的集群
                   -u:UDP协议的集群
                   service-address: IP:PORT
                   -f:FirewallMark/FWM;防火墙标记
                   service-address: Mark Number
  修改:-E
  删除:-D -t|u|f service-address
  
  例如 #ipvsadm -A -t 192.168.2.55:80 -s rr  
  
(2)管理集群服务中的RS
  添加:-a -t|u|f service-address -r server-address [-g|i|m] [-w weight]
                  -t|u|f service-address: 事先定义好的某集群服务
                  -r service-address: 某realserver地址; 在Nat模型中,可使用ip:port实现端口映射;
                  [-g|i|m] :LVS类型
                               -g:DR;
                               -i:TUN;
                              -m:NAT;
                   [-w weight] 定义服务器权重;

  修改:-e
  删除:-d -t|u|f service-address -r server-address
  #ipvsadm -a -t 192.168.2.55:80 -r 192.168.10.8 -m
  #ipvsadm -a -t 192.168.2.55:80 -r 192.168.10.9 -m
(3)查看规则
                        -L|l
                          -n: 数字格式显示IP地址和端口
                          –stats  统计数据
                          –rate 速率
                          –timeout 显示tcp,tcpfin,和udp的会话超时时间;
                          -c 显示当前IPVS连接状况的
    
(4)删除所有集群服务   
                          -C:清空IPVS规则;
保持规则:
                          -S
                  ipvsadm -S > /path/to/somefile
                  ipvsadm-save > /etc/sysconfig/ipvsadm
载入此前的规则
                           -R
                ipvsadm -R < /path/to/somefile
                ipvsadm-restore < /etc/sysconfig/ipvsadm

清空计数器
                           -Z

本文转自 jin626889 51CTO博客,原文链接:http://blog.51cto.com/zuoshou/1740753,如需转载请自行联系原作者