You map an external, or public, IP address to a set of internal servers for load balancing. The load balancer accepts TCP, HTTP, or HTTPS requests on the external IP address and decides which internal server to use.
For information about creating an application profile, see Create an Application Profile for the Load Balancer.
By default, Advanced Networking Services uses port 8090 as the listening port for TCP, port 80 as the port for HTTP, and port 443 as the port for HTTPs.
1 |
Log in to vCloud Air as an administrator. See Log in to vCloud Air for information. |
2 |
Create a login session with vCloud Director. See Create a Session for a Virtual Data Center in a Service for information. |
3 |
Using the vCloud API, query vCloud Director for the ID of the edge gateway that requires load balancer configuration. See Querying the vCloud API for information. |
1 | (Optional) Request the current load balancer configuration for the edge gateway. See List the Load Balancer Configuration. |
2 | Examine the response and update the required elements. For a description of each element of the load balancer schema, see Schema for Load Balancer Configuration. |
3 | Submit the updated configuration using the following request header and request body: PUT https://vchs.vmware.com/hybridity/api/gateways/gatewayId/lb/config In the request header, include the OATH token and the Accept header that you obtained when creating a login session: Accept: application/json Content-Type: application/json X-Vcloud-Authorization: "vcloud-auth-token" In the request body, include the schema elements you retrieved and updated from the GET request. The server returns status 204 NO CONTENT in the response header. The server does not return a response body. |
Request Header – Get the Load Balancer Configuration
GET https://vchs.vmware.com/hybridity/api/gateways/gw-5/lb/config Accept: application/json Content-Type: application/json X-Vcloud-Authorization: "d6eFLOqQYfuEn2MJTp7BQ2ISEO+ZYaEgTcqBy8wZQ6js="
A request body is not required.
Response Body – Get the Load Balancer Configuration
{ "featureType": "loadbalancer_4.0", "version": 7, "enabled": true, "enableServiceInsertion": false, "accelerationEnabled": false, "virtualServer": [ { "virtualServerId": "virtualServer-1", "name": "web-server-vip", "enabled": true, "ipAddress": "10.112.200.3", "protocol": "http", "port": "80", "connectionLimit": 0, "connectionRateLimit": 0, "defaultPoolId": "pool-1", "applicationProfileId": "applicationProfile-1", "enableServiceInsertion": false, "accelerationEnabled": false, "applicationRuleId": [] } ], "pool": [ { "poolId": "pool-1", "name": "web-server-pool", "algorithm": "round-robin", "transparent": false, "monitorId": [ "monitor-2" ], "applicationRuleId": [], "member": [ { "memberId": "member-1", "ipAddress": "172.0.0.10", "weight": 1, "monitorPort": 80, "port": 80, "maxConn": 0, "minConn": 0, "condition": "enabled", "name": "web1" }, ] } ], "applicationProfile": [ { "applicationProfileId": "applicationProfile-1", "persistence": { "method": "cookie", "cookieName": "SESSIONID", "cookieMode": "app", "expire": "300" }, "name": "HTTP", "insertXForwardedFor": false, "sslPassthrough": false, "template": "HTTP", "serverSslEnabled": false } ], "applicationRule": [], "monitor": [ { "monitorId": "monitor-1", "type": "tcp", "interval": 5, "timeout": 15, "maxRetries": 3, "name": "default_tcp_monitor" }, { "monitorId": "monitor-2", "type": "http", "interval": 5, "timeout": 15, "maxRetries": 3, "method": "GET", "url": "/", "name": "default_http_monitor" }, { "monitorId": "monitor-3", "type": "https", "interval": 5, "timeout": 15, "maxRetries": 3, "method": "GET", "url": "/", "name": "default_https_monitor" } ], "logging": { "enable": false, "logLevel": "info" } }
Request Header – Add a Server Pool Member
PUT https://vchs.vmware.com/hybridity/api/gateways/gw-5/lb/config Accept: application/json Content-Type: application/json X-Vcloud-Authorization: "d6eFLOqQYfuEn2MJTp7BQ2ISEO+ZYaEgTcqBy8wZQ6js="
Request Body – Add a Server Pool Member
{ "featureType": "loadbalancer_4.0", "version": 7, "enabled": true, "enableServiceInsertion": false, "accelerationEnabled": false, "virtualServer": [ { "virtualServerId": "virtualServer-1", "name": "web-server-vip", "enabled": true, "ipAddress": "10.112.200.3", "protocol": "http", "port": "80", "connectionLimit": 0, "connectionRateLimit": 0, "defaultPoolId": "pool-1", "applicationProfileId": "applicationProfile-1", "enableServiceInsertion": false, "accelerationEnabled": false, "applicationRuleId": [] } ], "pool": [ { "poolId": "pool-1", "name": "web-server-pool", "algorithm": "round-robin", "transparent": false, "monitorId": [ "monitor-2" ], "applicationRuleId": [], "member": [ { "memberId": "member-1", "ipAddress": "172.0.0.10", "weight": 1, "monitorPort": 80, "port": 80, "maxConn": 0, "minConn": 0, "condition": "enabled", "name": "web1" }, { "memberId": "member-2", "ipAddress": "172.0.0.11", "weight": 1, "monitorPort": 80, "port": 80, "maxConn": 0, "minConn": 0, "condition": "enabled", "name": "web2" } ] } ], "applicationProfile": [ { "applicationProfileId": "applicationProfile-1", "persistence": { "method": "cookie", "cookieName": "SESSIONID", "cookieMode": "app", "expire": "300" }, "name": "HTTP", "insertXForwardedFor": false, "sslPassthrough": false, "template": "HTTP", "serverSslEnabled": false } ], "applicationRule": [], "monitor": [ { "monitorId": "monitor-1", "type": "tcp", "interval": 5, "timeout": 15, "maxRetries": 3, "name": "default_tcp_monitor" }, { "monitorId": "monitor-2", "type": "http", "interval": 5, "timeout": 15, "maxRetries": 3, "method": "GET", "url": "/", "name": "default_http_monitor" }, { "monitorId": "monitor-3", "type": "https", "interval": 5, "timeout": 15, "maxRetries": 3, "method": "GET", "url": "/", "name": "default_https_monitor" } ], "logging": { "enable": false, "logLevel": "info" } }
Create an edge gateway firewall rule to permit traffic to the new virtual server (the destination IP address). See Configure the Edge Gateway Firewall.