Uso de LVS ipvsadm comandos y parámetros

1, software de gestión de LVS-servidor instalado LVS

yum -y install ipvsadm

Paquete: ipvsadm (herramienta de gestión de LVS)

El programa principal: / usr / sbin / ipvsadm

Reglas Guardar herramienta: / usr / sbin / ipvsadm-Save> / ruta / a / archivo

fichero de configuración: / etc / sysconfig / ipvsadm-config

2, Opciones de comando
-A --add-service #在服务器列表中新添加一条新的虚拟服务器记录
-t #表示为tcp服务
-u #表示为udp服务
-s --scheduler #使用的调度算法, rr | wrr | lc | wlc | lblb | lblcr | dh | sh | sed | nq 默认调度算法是 wlc
例:ipvsadm -A -t 192.168.1.2:80 -s wrr    rr轮询

-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 --ip #指定LVS的工作模式为隧道模式
-p #会话保持时间,定义流量呗转到同一个realserver的会话存留时间
例:ipvsadm -a -t 192.168.1.2:80 -r 192.168.2.10:80 -m -w 1

-E -edit-service #编辑内核虚拟服务器表中的一条虚拟服务器记录。
-D -delete-service #删除内核虚拟服务器表中的一条虚拟服务器记录。
-C -clear #清除内核虚拟服务器表中的所有记录。
-R -restore #恢复虚拟服务器规则
-S -save #保存虚拟服务器规则到标准输出,输出为-R 选项可读的格式
-e -edit-server #编辑一条虚拟服务器记录中的某条真实服务器记录
-d -delete-server #删除一条虚拟服务器记录中的某条真实服务器记录
-L|-l –list #显示内核虚拟服务器表

--numeric, -n:#以数字形式输出地址和端口号
--exact: #扩展信息,精确值 
--connection,-c: #当前IPVS连接输出
--stats: #统计信息
--rate : #输出速率信息

参数也可以从/proc/net/ip_vs*映射文件中查看
-Z –zero #虚拟服务表计数器清零(清空当前的连接数量等)
[root@lvs-server ~]# ipvsadm -ln    (查看保存的规则)
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  192.168.246.160:80 rr
  -> 192.168.246.161:80           Route   1      0          0         
  -> 192.168.246.162:80           Route   1      0          0         
[root@lvs-server ~]# ipvsadm -L -n       
[root@lvs-server ~]# ipvsadm -L -n --stats    #显示统计信息
1. Conns    (connections scheduled)  已经转发过的连接数
2. InPkts   (incoming packets)       入包个数
3. OutPkts  (outgoing packets)       出包个数
4. InBytes  (incoming bytes)         入流量(字节)  
5. OutBytes (outgoing bytes)         出流量(字节)
[root@lvs-server ~]# ipvsadm -L -n --rate	#看速率
1. CPS      (current connection rate)   每秒连接数
2. InPPS    (current in packet rate)    每秒的入包个数
3. OutPPS   (current out packet rate)   每秒的出包个数
4. InBPS    (current in byte rate)      每秒入流量(字节)
5. OutBPS   (current out byte rate)      每秒出流量(字节)
Publicado 48 artículos originales · alabanza ganado 18 · vistas 3644

Supongo que te gusta

Origin blog.csdn.net/wx912820/article/details/104936602
Recomendado
Clasificación