Create Load Balancer

(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 95)

Revision as of 16:43, 2 July 2014

A Load balancer distributes traffic among different nodes. You have the ability to configure your load balancer as required. A Load balancer has a single public-facing virtual IP Address and port on one side and nodes on the other side: traffic into the virtual IP may be delivered to the IP Address of any of the contained nodes. The reverse mapping occurs for outbound traffic. If you need to provide load balancing for more than one virtual IP address or more than one port on a single virtual IP address, you must create multiple load balancers. Note: a load balancer without a virtual IP address and at least two nodes is not useful

Contents

POST /accounts/{accountId}/loadbalancers

This operation will create a new load balancer.

Request

URI Parameters

accountId - string
The selected account Id.

Request Body

 {
    "region": "{regionTextKey}",
    "displayName": "{lbName}",
    "port": {lbPort},
    "protocol": "{lBProtocol}",
    "virtualIp": "{lbVirtualIp}",
    "algorithm": "{ROUND_ROBIN or SOURCE_IP}",
    "timeout": {timeout},
    "nodes" : [
                   {
                       "serverRef": "{serverRefURL}",
                       "port" : {port1}
                   },
                   {
                       "serverRef": "{serverRefURL}",
                       "port" : {port2}
                   }
               ]
    "sessionPersistence" : {
                       "persistenceType":"HTTP_COOKIE"
               },          
    "healthMonitor" :      {
               "protocol":"{hcProtocol}",
               "interval": {hcInterval},
               "port": {hcPort},
               "uri": {uri},
               "attemptsBeforeDeactivation": {hcAttemptsBeforeDeactivation},
               "attemptsBeforeActivation" : {hcAttemptsBeforeActivation}
           },
 }

Parameters

region - string
region TextKey where LB will be created
displayName - string
Display name for this load balancer.
port - integer
range 1 ~ 65535
the port number to switch traffic for.
protocol - string
either 'TCP' or 'HTTP'
virtualIp - string
if this is omitted, LB will allocate a new virtual ip to this account
this virtual ip that must be owned by this account in advance or available one
IPv4 or IPv6 possible
algorithm - string
LB distribution algorithm
either 'ROUND_ROBIN' or 'SOURCE_IP'
timeout - integer
node-check and connect timeout
nodes
list of node
should include at least one node when creating a LB
nodes.serverRef - string
the URL ref of a node
nodes.port - integer
range 1 ~ 65535
the ports on node that LB forward traffic to
nodes.condition - string
the condition of a node, ENABLED or DISABLED

Response

Response Codes

201 Created
400 Bad Request
401 Unauthorized
This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
409 Conflict
The resource already exists. (there is already a load balancer with that name or a load balancer already bound to the virtualIp/port combination specified)

Response Headers

Location
Returned with successful 201 response. Contains the new LB URI. The client must use this URI for all subsequent operations with the LB.

Examples

Request

POST /accounts/{accountId}/loadbalancers
Content-Type: application/json; Charset=UTF-8
Authorization: Base64-encoded username & password string

{
    "region": "AUSTIN",
    "displayName" : "Test Load Balancer",
    "port": 80,
    "protocol": "HTTP",
    "algorithm": "ROUND_ROBIN",
    "timeout": 30,
    "nodes": [
        {
            "serverRef": "http://{hostname}/accounts/{accountId}/flexcloud/servers/{serverId-1}",
            "port": 80
        }, {
            "serverRef": "http://{hostname}/accounts/{accountId}/flexcloud/servers/{serverId-2}",
            "port": 80
        }
    ]        
}

Response

201 Created
Content-Type: application/json; charset=UTF-8
Location : </nowiki>{{APIBaseURL}}<nowiki>/account/{accountId}/loadbalancer/{lbId}


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox