本文共 5357 字,大约阅读时间需要 17 分钟。
slb real http[port] [max_conn][{http|tcp|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up] [hc_down]slb real tcp [max_conn][{http|tcp|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up] [hc_down]slb real ftp [port] [max_conn] [{tcp|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up] [hc_down]slb real udp [max_conn] [hc_up] [hc_down] [timeout] [{icmp|script-tcp|script-udp|radius-auth|radius-acct}]slb real https [port] [max_conn] [{https|tcp|tcps|icmp|script-tcp|script-udp|script-tcps|sip-tcp|sip-udp}] [hc_up] [hc_down]slb real tcps [max_conn] [{tcp|tcps|icmp|script-tcp|script-udp|script-tcps|sip-tcp|sip-udp}] [hc_up] [hc_down]slb real dns [max_conn] [{dns|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up] [hc_down] [timeout]slb real siptcp [port] [max_conn] [{ http|tcp|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up][hc_down]slb real sipudp [port] [max_conn] [{icmp|script-tcp|script-udp|radius-auth|radius-acct|sip-tcp|sip-udp}] [hc_up][hc_down][timeout]slb real rtsp [port] [max_conn] [{rtsp-tcp|tcp|icmp|script-tcp|script-udp|none}] [hc_up] [hc_down] [timeout]
基于三层(IP)的类型为“IP”的后台服务。该类服务能同时支持TCP和UDP协议
slb real ip[max_conn] [{icmp|none}] [hc_up] [hc_down] [udp timeout]
例 33.1. slb real http
slb real http rs1 172.16.0.9 80slb real http rs2 172.16.0.5 80Array(config)#show slb real httpslb real http "rs1" 172.16.0.9 80 1000 tcp 3 3slb real http "rs2" 172.16.0.5 80 1000 tcp 3 3Array(config)#clear slb real httpslb real http rs1 172.16.0.9 80 4096 httpslb real http rs2 172.16.0.5 80 4096 httpArray(config)#show slb real httpslb real http "rs1" 172.16.0.9 80 4096 http 3 3slb real http "rs2" 172.16.0.5 80 4096 http 3 3Array(config)#show health server----------------------------------- Server Status ---------------------------------real server name statusrs1 UPrs2 UP----------------------------------- Health Check ----------------------------------real server name ip :port status hct rqr rpr checklist-----------------------------------------------------------------------------------rs1 172.16.0.9 :80 UP http 0 0rs2 172.16.0.5 :80 UP http 0 0
4-7 layer slb
slb virtual http[vport] [{arp|noarp}] [max_conn]slb virtual https [vport] [{arp|noarp}] [max_conn]slb virtual tcp [{arp|noarp}] [max_conn]slb virtual tcps [{arp|noarp}] [max_conn]slb virtual ftp [vport] [max_conn]slb virtual udp [{arp|noarp}] [max_conn]slb virtual dns [vport] [{arp|noarp}] [max_conn]slb virtual sipudp [vport] [{arp|noarp}] [max_conn]slb virtual siptcp [vport] [{arp|noarp}] [max_conn]slb virtual rtsp [vport] [mode] [noarp] [max_conn]
3 layer slb
slb virtual ip这个命令是用来创建基于三层协议的负载均衡操作的虚拟服务。这种虚拟服务可以同时支持TCP和UDP协议。
例 33.2. slb virtual http
slb virtual http vs1 172.16.0.3 80Array(config)#show slb virtual httpslb virtual http "vs1" 172.16.0.3 80 arp 0
slb group method[algorithm]algorithm 在组内的后台服务中进行负载均衡的算法。可选参数,缺省值为轮循(rr)。基于使用的算法,需要不同的扩展参数。下面标有"*"的算法需要扩展参数。 rr 轮循 pc 保持 Cookie* pi 保持 IP地址* hi Hash IP地址* hc Hash Cookie* ph 保持域名* pu 保持 URL* ic 插入 Cookie* rc 改写 Cookie* ec 嵌入 Cookie* lc 最少连接数* sr 最短响应时间 hh Hash Header* sslsid SSL Session ID* chi Consistent Hash IP* prox 就近性* snmp 简单网络管理协议* sipcid SIP CallID* sipuid SIP UserID* chh Consistent Hash Header* hq Hash Query* hip Hash (IP+Port) *
例 33.3. slb group method
Array(config)#slb group method gm1 rrArray(config)#show slb group methodslb group method "gm1" rr
slb group member
例 33.4. slb group member
Array(config)#slb group member gm1 rs1Array(config)#slb group member gm1 rs2Array(config)#show slb group member gm1slb group member "gm1" "rs1" 1slb group member "gm1" "rs2" 1
slb policy default "vs1" "gm1"
例 33.5. slb policy default
Array(config)#slb policy default "vs1" "gm1"Array(config)#show slb policy allslb policy default "vs1" "gm1"
这条命令允许系统管理员清空指定服务组的保持性关系表。这条命令会消除所有已经建立的保持性关系,所有使用这条命令时有提醒信息。已经建立保持连接的用户,会被迫重新建立保持性连接。“group_name”参数,必须是采用hc、hh、ph或者pi算法的服务组。
slb group flush
例 33.6. slb example
slb real http "http-nginx-0" 10.0.0.68 80 100000 http 3 3slb real http "http-nginx-1" 10.0.0.69 80 100000 http 3 3slb real http "http-user-1" 10.0.0.24 80 100000 http 3 3slb real http "http-user-2" 10.0.0.25 80 100000 http 3 3slb real http "http-user-3" 10.0.0.26 80 100000 http 3 3slb group method "group-nginx-0" rrslb group member "group-nginx-0" "http-nginx-0" 1 0slb group member "group-nginx-0" "http-nginx-1" 1 0slb virtual http "vs-nginx-http" 172.16.0.60 80 arp 0slb group method "group-user-0" rrslb group member "group-user-0" "http-user-1" 1 0slb group member "group-user-0" "http-user-2" 1 0slb group member "group-user-0" "http-user-3" 1 0slb virtual http "vs-user-http" 172.16.0.61 80 arp 0slb policy default "vs-nginx-http" "group-nginx-0"slb policy default "vs-user-http" "group-user-0"