Citrix ADC

API-Methode

Sie können die API-Methode verwenden, um den GSLB-Dienst mit der besten Leistung zu ermitteln. Die API-Methode für GSLB verwendet eine REST-API, um den am besten ausführenden GSLB-Dienst zu ermitteln.

Wenn GSLB in der API-Methode eine DNS-Anforderung von einem Client empfängt, wertet sie die Anforderung anhand der angegebenen Regel aus. Wenn GSLB den HTTP-Callout-Ausdruck SYS.HTTP_CALLOUT () trifft, ruft es eine REST-API-Anforderung an einen HTTP-Callout-Agent auf. GSLB verwendet die Antwort des HTTP-Callout-Agenten, um den Dienst am besten zu bestimmen. In der DNS-Antwort gibt GSLB die IP-Adresse des leistungsstärksten Dienstes zurück an den Client zurück.

So konfigurieren Sie eine GSLB-API-Methode mit der CLI

Gehen Sie folgendermaßen vor, um die GSLB-API-Methode zu konfigurieren:

  1. Konfigurieren Sie ein HTTP-Callout.

    Weitere Informationen finden Sie unterKonfigurieren eines HTTP-Callouts.

    Geben Sie an der Eingabeaufforderung Folgendes ein:

    add policy httpCallout  [-IPAddress ] [-port ] [-vServer ] [-returnType ] [-httpMethod (GET | POST)] [-hostExpr ] [-urlStemExpr ] [-headers  ...] [-parameters  ...] [-bodyExpr ] [-fullReqExpr ] [-scheme (http | https)] [-resultExpr ] [-cacheForSecs ] [-comment ] 

    Beispiel:

    add policy httpCallout GSLB_Method_API -IPAddress 208.111.39.237 -port 443 -returnType TEXT -hostExpr “\”hopx.gslb.com\“” -urlStemExpr “\”/zones/1/customers/92395/apps/6/decision\“” -headers Authorization(“Basic 19fbe6db-4332-4e3f-a8bc-ee47bdc726f8") -parameters ip(DNS.REQ.OPT.ECS.IP.TYPECAST_TEXT_T ALT CLIENT.IP.SRC.TYPECAST_TEXT_T) -scheme https -resultExpr “HTTP.RES.BODY(HTTP.RES.CONTENT_LENGTH).XPATH_JSON(xp%/providers/Val[1]/provider%)” -cacheForSecs 30 
  2. Geben Sie die API-Methode für den Lastenausgleich an. GSLB wertet die DNS-Anforderung anhand der angegebenen Regel aus.

    Geben Sie an der Eingabeaufforderung Folgendes ein:

    add gslb vserver   [-lbMethod ] [-backupLBMethod ] -rule  

    Beispiel:

    添加gslb vserver vs1 HTTP -backupLBM -lbMethod APIethod ROUNDROBIN -rule “sys.http_callout(GSLB_Method_API)” 

Beispielkonfiguration für die Integration von GSLB und ITM mit API als LB-Methode

这张Konfiguration ermoglicht es GSLB,死的实习生etsichtbarkeitsaspekte des Citrix Intelligent Traffic Management (ITM) zu verwenden, um den leistungsstärksten GSLB-Dienst zu ermitteln.

/ *启用ns特性* /磅gslb启用ns特性cs /* This is a named expression that is used in the HTTP callout, used for result expression. */ add policy expression exp1 "HTTP.RES.BODY(HTTP.RES.CONTENT_LENGTH).XPATH_JSON(xp%/providers/Val[1]/provider%)" /* This is a named expression that is used in HTTP callout, used for host expression. */ add policy expression exp2 ""hopx.cedexis.com"" /* This is the HTTP callout configured to request the ITM for the GSLB decision. */ add policy httpCallout ITM_OpenMix_API -IPAddress 208.111.39.237 -port 80 -returnType TEXT -hostExpr exp2 -urlStemExpr ""/zones/1/customers/61770/apps/3/decision"" -headers Authorization("Basic a310697a-1d69-48bf-8f36-55742a8e894e") -parameters ip(DNS.REQ.OPT.ECS.IP.TYPECAST_TEXT_T ALT CLIENT.IP.SRC.TYPECAST_TEXT_T) -scheme http -resultExpr exp1 -cacheForSecs 30 /* Add service 1 */ add service sg1 98.136.103.24 HTTP 80 -gslb NONE -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport YES -sp OFF -cltTimeout 180 -svrTimeout 360 -CKA NO -TCPB NO -CMP NO /* Add service 2 */ add service sg2 172.217.194.113 HTTP 80 -gslb NONE -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport YES -sp OFF -cltTimeout 180 -svrTimeout 360 -CKA NO -TCPB NO -CMP NO /* Add ADNS service */ add service adns1 10.102.217.106 ADNS 53 -gslb NONE -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport NO -sp OFF -cltTimeout 120 -svrTimeout 120 -CKA NO -TCPB NO -CMP NO /* Add lb vserver 1 for service 1 */ add lb vserver lbvs1 HTTP 10.102.217.116 80 -persistenceType NONE -cltTimeout 180 /* Add lb vserver 2 for service 2 */ add lb vserver lbvs2 HTTP 10.102.217.117 80 -persistenceType NONE -cltTimeout 180 /* Bind service 1 to lb vserver 1 */ bind lb vserver lbvs1 sg1 /* Bind service 2 to lb vserver 2 */ bind lb vserver lbvs2 sg2 /* Configure API GSLB method on GSLB virtual server to call the HTTP callout. This HTTP callout requests the ITM for the GSLB decision and returns GSLB service name, which should serve the request. */ add gslb vserver vs1 HTTP -lbMethod API -backupLBMethod ROUNDROBIN -rule "sys.http_callout(ITM_OpenMix_API)" -tolerance 0 /* Add GSLB site */ add gslb site site1 10.102.217.106 -publicIP 10.102.217.106 /* Add GSLB service 1 */ add gslb service aws_ec2_ap_south_1_asia_pacific_mumbai_1 10.102.217.116 HTTP 80 -publicIP 10.102.217.116 -publicPort 80 -maxClient 0 -siteName site1 -sitePersistence HTTPRedirect -sitePrefix gs2. -cltTimeout 180 -svrTimeout 360 -downStateFlush ENABLED /* Add GSLB service 2 */ add gslb service aws_ec2_ap_south_1_asia_pacific_mumbai 10.102.217.117 HTTP 80 -publicIP 10.102.217.117 -publicPort 80 -maxClient 0 -siteName site1 -sitePersistence HTTPRedirect -sitePrefix gs1. -cltTimeout 180 -svrTimeout 360 -downStateFlush ENABLED /* Bind the GSLB service 1 to GSLB server 1 */ bind gslb vserver vs1 -serviceName aws_ec2_ap_south_1_asia_pacific_mumbai_1 /* Bind the GSLB service 2 to GSLB server 2 */ bind gslb vserver vs1 -serviceName aws_ec2_ap_south_1_asia_pacific_mumbai /* Bind a domain name to the GSLB virtual server */ bind gslb vserver vs1 -domainName testruchit104.com -TTL 5 
API-Methode