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]
例 33.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
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協議。
例 33.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
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) *
例 33.3. slb group method
Array(config)#slb group method gm1 rr Array(config)#show slb group method slb group method "gm1" rr
slb group member <group_name> <real_name>
例 33.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
slb policy default "vs1" "gm1"
例 33.5. slb policy default
Array(config)#slb policy default "vs1" "gm1" Array(config)#show slb policy all slb 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 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"