
vShield API Programming Guide
44 VMware, Inc.
Start or Stop the Load Balancer Service on a vShield Edge
Example 5-50. Starting or Stopping the Load Balancer Service on a vShield Edge
Request:
PUT <vshield_manager-uri>/api/1.0/network/<internal-portgroup-vc-moref-id>/
loadbalancer/action/{start | stop}
Example:
PUT /api/1.0/network/network-244/loadbalancer/action/start HTTP/1.1
Authorization: Basic YWRtaW46ZGVmYXVsdA==
Host: localhost:9998
Add a Listener for Load Balancing Service
YoucanmapaglobalorpublicIPaddresswithasetofinternalserversforloadbalancing.Theloadbalancer
acceptsHTTPrequestsonthisIPaddress.TheinternalIPlistisacomma‐separatedlistofoneormore
IP:Portinstancesthatrepresentsserversthatcanbeusedforloadbalancing.
Ifaportisnotspecified,port80
isthedefaultport.ThevShieldManagerprocessesthepostedXMLfileasacompletesetofloadbalancing
serversforthespecificnetwork.Thecurrentsetofloadbalancingserversforanetworkisreplacedwiththis
newsetofservers.
You
canaddmultipleserversaslistenersbyenteringmultiple<Listener />sectionsinthebody.
Youcanconfigurethealgorithmthatisusedtodetermineloadbalancing.Theoptional<algorithm />
elementcanbesettoround-robinorip-hash.Bydefault,theloadbalanceralgorithmissettoround‐robin.
Example 5-51. Adding a Load Balancer Listener on a vShield Edge
Request:
POST <vshield_manager-uri>/api/1.0/network/<internal-portgroup-vc-moref-id>/loadbalancer/
Rules:
Loggingisdisabledbydefault.Toenablelogging,adda<log />elementwithin<Listener />.
ThebackendServersinternalIPListelementisacommaseparatedIPlist.Port80isusedbydefault.
YoucanspecifycustomIP:PortvaluesintheinternalIPList.
Example:
Basicloadbalancerconfiguration
POST /api/1.0/network/network-244/loadbalancer HTTP/1.1
Content-Type: application/xml
Authorization: Basic YWRtaW46ZGVmYXVsdA==
Host: localhost:9998
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-Length: 490
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><VShieldEdgeConfig><LoadBalancerConfig><Listener>
<externalIPAddress>10.112.196.95</externalIPAddress><BackEndServers>
<internalIPList>172.17.1.11,172.17.1.12</internalIPList></BackEndServers>
<algorithm>ip-hash</algorithm></Listener><Listener><externalIPAddress>
10.112.196.96</externalIPAddress><BackEndServers><internalIPList>
172.17.1.11,172.17.1.12</internalIPList></BackEndServers></Listener>
</LoadBalancerConfig></VShieldEdgeConfig>
Commenti su questo manuale