Home | 简体中文 | 繁体中文 | 杂文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品与服务 | Email

24.8. slb configuration

24.8.1. slb real

			
slb real http <real_name> <ip> [port] [max_conn][{http|tcp|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up] [hc_down]
slb real tcp <real_name> <ip> <port> [max_conn][{http|tcp|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up] [hc_down]
slb real ftp <real_name> <ip> [port] [max_conn] [{tcp|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up] [hc_down]
slb real udp <real_name> <ip> <port> [max_conn] [hc_up] [hc_down] [timeout] [{icmp|script-tcp|script-udp|radius-auth|radius-acct}]
slb real https <real_name> <ip> [port] [max_conn] [{https|tcp|tcps|icmp|script-tcp|script-udp|script-tcps|sip-tcp|sip-udp}] [hc_up] [hc_down]
slb real tcps <real_name> <ip> <port> [max_conn] [{tcp|tcps|icmp|script-tcp|script-udp|script-tcps|sip-tcp|sip-udp}] [hc_up] [hc_down]
slb real dns <real_name> <ip> <port> [max_conn] [{dns|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up] [hc_down] [timeout]
slb real siptcp <real_name> <ip> [port] [max_conn] [{ http|tcp|icmp|script-tcp|script-udp|sip-tcp|sip-udp}] [hc_up][hc_down]
slb real sipudp <real_name> <ip> [port] [max_conn] [{icmp|script-tcp|script-udp|radius-auth|radius-acct|sip-tcp|sip-udp}] [hc_up][hc_down][timeout]
slb real rtsp <real_name> <ip> [port] [max_conn] [{rtsp-tcp|tcp|icmp|script-tcp|script-udp|none}] [hc_up] [hc_down] [timeout]
			
			

基于三层(IP)的类型为“IP”的后台服务。该类服务能同时支持TCP和UDP协议

			
slb real ip <real_name> <IP> [max_conn] [{icmp|none}] [hc_up] [hc_down] [udp timeout]
			
			

例 24.1. slb real http

				
slb real http rs1 172.16.0.9 80
slb real http rs2 172.16.0.5 80

Array(config)#show slb real http
slb real http "rs1" 172.16.0.9 80 1000 tcp 3 3
slb real http "rs2" 172.16.0.5 80 1000 tcp 3 3

Array(config)#clear  slb real http
slb real http rs1 172.16.0.9 80 4096 http
slb real http rs2 172.16.0.5 80	4096 http

Array(config)#show slb real http
slb real http "rs1" 172.16.0.9 80 4096 http 3 3
slb real http "rs2" 172.16.0.5 80 4096 http 3 3

Array(config)#show health server
----------------------------------- Server Status ---------------------------------
real server name      status
rs1                   UP
rs2                   UP
----------------------------------- Health Check ----------------------------------
real server name      ip              :port    status  hct        rqr rpr checklist
-----------------------------------------------------------------------------------
rs1                   172.16.0.9      :80      UP      http         0   0
rs2                   172.16.0.5      :80      UP      http         0   0

				
				

24.8.2. slb virtual

4-7 layer slb

			
slb virtual http <virtual_name> <vip> [vport] [{arp|noarp}] [max_conn]
slb virtual https <virtual_name> <vip>[vport] [{arp|noarp}] [max_conn]
slb virtual tcp <virtual_name> <vip> <vport> [{arp|noarp}] [max_conn]
slb virtual tcps <virtual_name> <vip><vport> [{arp|noarp}] [max_conn]
slb virtual ftp <virtual_name> <vip> [vport] [max_conn]
slb virtual udp <virtual_name> <vip> <vport> [{arp|noarp}] [max_conn]
slb virtual dns <virtual_name> <vip> [vport] [{arp|noarp}] [max_conn]
slb virtual sipudp <virtual_name> <vip>[vport] [{arp|noarp}] [max_conn]
slb virtual siptcp <virtual_name> <vip> [vport] [{arp|noarp}] [max_conn]
slb virtual rtsp <virtual_name> <vip> [vport] [mode] [noarp] [max_conn]
			
			

3 layer slb

			
slb virtual ip <virtual name> <IP>

这个命令是用来创建基于三层协议的负载均衡操作的虚拟服务。这种虚拟服务可以同时支持TCP和UDP协议。
			
			

例 24.2. slb virtual http

				
slb virtual http vs1 172.16.0.3 80

Array(config)#show slb virtual http
slb virtual http "vs1" 172.16.0.3 80 arp 0
				
				

24.8.3. slb group method

			
slb group method <group_name> [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) *
			
			

例 24.3. slb group method

				
Array(config)#slb group method gm1 rr

Array(config)#show slb group method
slb group method "gm1" rr
				
				

24.8.4. slb group member

			
slb group member <group_name> <real_name>
			
			

例 24.4. slb group member

				
Array(config)#slb group member gm1 rs1

Array(config)#slb group member gm1 rs2

Array(config)#show slb group member gm1
slb group member "gm1" "rs1" 1
slb group member "gm1" "rs2" 1
				
				

24.8.5. slb policy

			
slb policy default "vs1" "gm1"
			
			

例 24.5. slb policy default

Array(config)#slb policy default "vs1" "gm1"

Array(config)#show slb policy all
slb policy default "vs1" "gm1"
				

24.8.6. slb group flush

这条命令允许系统管理员清空指定服务组的保持性关系表。这条命令会消除所有已经建立的保持性关系,所有使用这条命令时有提醒信息。已经建立保持连接的用户,会被迫重新建立保持性连接。“group_name”参数,必须是采用hc、hh、ph或者pi算法的服务组。

slb group flush
			

24.8.7. slb configuration example

例 24.6. slb example

slb real http "http-nginx-0" 10.0.0.68 80 100000 http 3 3
slb real http "http-nginx-1" 10.0.0.69 80 100000 http 3 3

slb real http "http-user-1" 10.0.0.24 80 100000 http 3 3
slb real http "http-user-2" 10.0.0.25 80 100000 http 3 3
slb real http "http-user-3" 10.0.0.26 80 100000 http 3 3


slb group method "group-nginx-0" rr
slb group member "group-nginx-0" "http-nginx-0" 1 0
slb group member "group-nginx-0" "http-nginx-1" 1 0
slb virtual http "vs-nginx-http" 172.16.0.60 80 arp 0

slb group method "group-user-0" rr
slb group member "group-user-0" "http-user-1" 1 0
slb group member "group-user-0" "http-user-2" 1 0
slb group member "group-user-0" "http-user-3" 1 0
slb virtual http "vs-user-http" 172.16.0.61 80 arp 0

slb policy default "vs-nginx-http" "group-nginx-0"
slb policy default "vs-user-http" "group-user-0"
				

comments powered by Disqus