Action
field in the common request parameters of this API is CreateLoadBalancer
. The list below contains the API request parameters.Parameter | Description | Value |
loadBalancerType | CLB instance type. | 2: public network CLB instance, the service of which is accessed via a public network. |
https://lb.api.qcloud.com/v2/index.php?Action=CreateLoadBalancer&Region=ap-guangzhou&Timestamp=1465750149&Nonce=46364&SecretId=AKID****ugEY&Signature=5umi****pTTyk18V2g%2FYi56hqls%3D&loadBalancerType=2
{"code": 0,"message": "","codeDesc": "Success","requestId": 3901941,"dealIds": ["3901941"],"unLoadBalancerIds": {"3901941": ["lb-lb-cjcy****"]}}
lb-cjcymkw5
is the unique ID of the CLB instance you just purchased. Next, use the DescribeLoadBalancers API to query whether the instance has been successfully created.Parameter | Description | Value |
loadBalancerId | Unique ID of the CLB instance | This example uses the unique ID of the instance you’ve just created, i.e. lb-cjcy**** |
listeners.0.loadBalancerPort | Listening port of the CLB listener. | 80 |
listeners.0.instancePort | Listening port on real server of the CLB instance. | 80 |
listeners.0.protocol | Protocol listened by the CLB listener. 1: HTTP; 2: TCP; 3: UDP; 4: HTTPS | This example uses 2: TCP |
listeners.0.healthSwitch | Whether to enable the health check for the CLB listener. 1: enable; 0: disable. The health check is enabled by default. | This example uses 1: enable |
listeners.0.listenerName | Name of the CLB listener. This field is optional. Default value will be used if it is left empty. | This example uses listenerTest |
https://lb.api.qcloud.com/v2/index.php?Action=CreateLoadBalancerListeners&Region=ap-guangzhou&Timestamp=1465750149&Nonce=46364&SecretId=AKID****ugEY&Signature=5umi****pTTyk18V2g%2FYi56hqls%3D&loadBalancerId=lb-cjcy****&listeners.0.loadBalancerPort=80&listeners.0.instancePort=80&listeners.0.protocol=2&listeners.0.healthSwitch=1&listeners.0.listenerName=listenerTest
{"code" : 0,"message" : "","codeDesc": "Success","requestId" : 12354}
ins-5678test
and ins-1234test
respectively) on the CLB instance. The Action
field in the common request parameters of this API is RegisterInstancesWithLoadBalancer
. The list below contains the API request parameters.Parameter | Description | Value |
loadBalancerId | Unique ID of the CLB instance. | This example uses the unique ID of the instance you’ve just created: lb-abcdefgh |
backends.0.instanceId | Unique ID of the CVM bound to the CLB instance. | This example uses the unique ID of the first CVM: ins-5678test |
backends.0.weight | Weight of the CVM bound to the CLB instance. | This example uses the default value 10 |
backends.1.instanceId | Unique ID of the CVM bound to the load balancer instance | This example uses the unique ID of the second CVM: ins-1234test |
backends.1.weight | Weight of the CVM bound to the CLB instance. | This example uses the default value 10 |
https://lb.api.qcloud.com/v2/index.php?Action=RegisterInstancesWithLoadBalancer&Region=ap-guangzhou&Timestamp=1465750149&Nonce=46364&SecretId=AKID****ugEY&Signature=5umi****pTTyk18V2g%2FYi56hqls%3D&loadBalancerId=lb-cjcy****&backends.0.instanceId=ins-5678****&backends.0.weight=10&backends.1.instanceId=ins-1234****&backends.1.weight=10
{"code" : 0,"message" : "","codeDesc": "Success","requestId" : 1234}
Action
field in the common request parameters of the API is DescribeLoadBalancers
. The list below contains the API request parameters.Parameter | Description | Value |
loadBalancerIds.0 | Unique ID of the CLB instance. | This example uses the unique ID of the instance you’ve just created: lb-cjcy**** |
https://lb.api.qcloud.com/v2/index.php?Action=DescribeLoadBalancers&Region=ap-guangzhou&Timestamp=1465750149&Nonce=46364&SecretId=AKID****ugEY&Signature=5umi****pTTyk18V2g%2FYi56hqls%3D&loadBalancerIds.0=lb-cjcy****
{"code": 0,"message": "","codeDesc": "Success","loadBalancerSet": [{"loadBalancerId": "lb-cjcy****","unLoadBalancerId": "lb-cjcy****","loadBalancerName": "59b25ffb-0","loadBalancerType": 2,"domain": "20de02-0.gz.1251000011.clb.myqcloud.com","loadBalancerVips": ["119.28.168.196"],"status": 1,"createTime": "2017-09-08 17:16:42","statusTime": "2017-09-20 13:37:55","vpcId": 0,"uniqVpcId": "","subnetId": 0,"projectId": 1005621,"forward": 0,"snat": false,"openBgp": 0,"isolation": 0,"log": ""}],"totalCount": 1}
119.28.168.XX
or domain name 20****-0.gz.1251000011.clb.myqcloud.com
of the CLB instance to forward the request to the associated backend CVMs according to the rule of CLB listener, thereby balancing the load.
Was this page helpful?