Chinaunix首页 | 论坛 | 博客
  • 博客访问: 209796
  • 博文数量: 47
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 482
  • 用 户 组: 普通用户
  • 注册时间: 2015-04-06 15:35
个人简介

贫则见廉,富则见义,生则见爱,死则见哀。

文章分类

全部博文(47)

分类: LINUX

2016-02-14 00:38:20

ipvsadm是配置内核流量分配策略的工具。它可以让我们选择采用什么策略来转发数据包。
最简单的策略就是轮循了。

Ipvsadm命令使用
2012 年 2 月 2 日 / 张明辉 发表于 Centos / 1 条评论
ipvsadm --help
ipvsadm v1.25 2008/5/15 (compiled with popt and IPVS v1.2.1)
Usage:
  ipvsadm -A|E -t|u|f service-address [-s scheduler] [-p [timeout]] [-M netmask]
  ipvsadm -D -t|u|f service-address
  ipvsadm -C
  ipvsadm -R
  ipvsadm -S [-n]
  ipvsadm -a|e -t|u|f service-address -r server-address [options]
  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] [--syncid sid]
  ipvsadm --stop-daemon state
  ipvsadm -h
 

Commands:
Either long or short options are allowed.
  --add-service     -A        add virtual service with options
  --edit-service    -E        edit virtual service with options
  --delete-service  -D        delete virtual service
  --clear           -C        clear the whole table
  --restore         -R        restore rules from stdin
  --save            -S        save rules to stdout
  --add-server      -a        add real server with options
  --edit-server     -e        edit real server with options
  --delete-server   -d        delete real server
  --list            -L|-l     list the table
  --zero            -Z        zero counters in a service or all services
  --set tcp tcpfin udp        set connection timeout values
  --start-daemon              start connection sync daemon
  --stop-daemon               stop connection sync daemon
  --help            -h        display this help message

Options:
  --tcp-service  -t service-address   service-address is host[:port]
  --udp-service  -u service-address   service-address is host[:port]
  --fwmark-service  -f fwmark         fwmark is an integer greater than zero
  --ipv6         -6                   fwmark entry uses IPv6
  --scheduler    -s scheduler         one of rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,
                                      the default scheduler is wlc.
  --persistent   -p [timeout]         persistent service
  --netmask      -M netmask           persistent granularity mask
  --real-server  -r server-address    server-address is host (and port)
  --gatewaying   -g                   gatewaying (direct routing) (default)
  --ipip         -i                   ipip encapsulation (tunneling)
  --masquerading -m                   masquerading (NAT)
  --weight       -w weight            capacity of real server
  --u-threshold  -x uthreshold        upper threshold of connections
  --l-threshold  -y lthreshold        lower threshold of connections
  --mcast-interface interface         multicast interface for connection sync
  --syncid sid                        syncid for connection sync (default=255)
  --connection   -c                   output of current IPVS connections
  --timeout                           output of timeout (tcp tcpfin udp)
  --daemon                            output of daemon information
  --stats                             output of statistics information
  --rate                              output of rate information
  --exact                             expand numbers (display exact values)
  --thresholds                        output of thresholds information
  --persistent-conn                   output of persistent connection info
  --nosort                            disable sorting output of service/server entries
  --sort                              does nothing, for backwards compatibility
  --numeric      -n                   numeric output of addresses and ports


命令解释:
有两种命令选项格式,长的和短的,具有相同的意思。在实际使用时,两种都可以。
  --add-service     -A        在内核的虚拟服务器表中添加一条新的虚拟服务器记录。也
就是增加一台新的虚拟服务器。
  --edit-service    -E        编辑内核虚拟服务器表中的一条虚拟服务器记录。
  --delete-service  -D        删除内核虚拟服务器表中的一条虚拟服务器记录。
  --clear           -C        清除内核虚拟服务器表中的所有记录。
  --restore         -R        恢复虚拟服务器规则
  --save            -S        保存虚拟服务器规则,输出为-R 选项可读的格式
  --add-server      -a        在内核虚拟服务器表的一条记录里添加一条新的真实服务器
记录。也就是在一个虚拟服务器中增加一台新的真实服务器。
  --edit-server     -e        编辑一条虚拟服务器记录中的某条真实服务器记录
  --delete-server   -d        删除一条虚拟服务器记录中的某条真实服务器记录
  --list            -L|-l     显示内核虚拟服务器表
  --zero            -Z        虚拟服务表计数器清零(清空当前的连接数量等)
  --set tcp tcpfin udp        设置连接超时值
  --start-daemon              启动连接同步守护进程。他后面可以是master 或backup,用来说
明LVS Router 是master 或是backup。在这个功能上也可以采用keepalived 的
VRRP 功能。
  --stop-daemon               停止连接同步守护进程
  --help            -h        显示帮助信息

选项的解释:
  --tcp-service  -t service-address   说明虚拟服务器提供的是 tcp 的服务。服务地址为 host[:port]
  --udp-service  -u service-address   说明虚拟服务器提供的是 udp 的服务。服务地址为 host[:port]
  --fwmark-service  -f fwmark         fwmark 是一个大于0的整数。说明是经过iptables 标记过的服务类型。
  --ipv6         -6                   使用 IPv6 的 fwmark 条目
  --scheduler    -s scheduler         使用的调度算法,有这样几个选项 rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq
                                      默认是 wlc.
  --persistent   -p [timeout]         持久服务。这个选项的意思是来自同一个客
户的多次请求,将被同一台真实的服务器处理。timeout 的默认值为300 秒。
  --netmask      -M netmask           持久稳固的服务的时间间隔。
  --real-server  -r server-address    真实的服务器host[:port]。
  --gatewaying   -g                   指定LVS 的工作模式为直接路由模式(也是LVS 默认的模式)(direct routing)
  --ipip         -i                   指定LVS 的工作模式为隧道模式 (tunneling)
  --masquerading -m                   指定LVS 的工作模式为NAT 模式 (NAT)
  --weight       -w weight            真实服务器的权值
  --u-threshold  -x uthreshold        连接数上限
  --l-threshold  -y lthreshold        连接数下限
  --mcast-interface interface         指定组播的同步接口
  --syncid sid                        同步连接的syncid (default=255)
  --connection   -c                   显示 LVS 目前的连接
  --timeout                           显示 tcp tcpfin udp 的 timeout 值 (tcp tcpfin udp)
  --daemon                            显示同步守护进程状态
  --stats                             显示统计信息
  --rate                              显示速率信息
  --exact                             数字详述 (显示精确的值)
  --thresholds                        显示上下限的信息
  --persistent-conn                   持久连接的信息
  --nosort                            不对虚拟服务器和真实服务器进行排序输出
  --sort                              无用,为了保持后面的兼容性
  --numeric      -n                   输出IP 地址和端口的数字形式
阅读(1884) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~