更新时间:2023-12-14 GMT+08:00
分享

创建监听器

操作场景

本章节通过示例演示如何调用API来创建监听器。

前提条件

  • 已创建负载均衡器。
  • 已获取负载均衡器的ID。

操作步骤

  1. 创建监听器
    1. 发送“POST https://{elb_endpoint}/v3/{project_id}/elb/listeners”,project_id为项目ID。
    2. 在Request Header中增加“X-Auth-Token”。
    3. 在Request Body中传入参数如下:
      {
      	"listener": {
      		"protocol_port": 80, // 前端协议端口
      		"protocol": "HTTP", // 前端协议
      		"loadbalancer_id": "f77281cb-9f58-4347-8f82-2180d8bea789", // 关联的负载均衡器
      		"name": "my_listener" // 监听器名称
      	}
      }
    4. 查看请求响应结果。
      • 请求成功时,响应参数如下:
        {
            "listener": {
                "id": "90ad2705-4ffd-43d3-8f75-af8086bde841",
                "name": "my_listener",
                "protocol_port": 80,
                "protocol": "HTTP",
                "description": "",
                "default_tls_container_ref": null,
                "admin_state_up": true,
                "loadbalancers": [
                    {
                        "id": "f77281cb-9f58-4347-8f82-2180d8bea789"
                    }
                ],
                "client_ca_tls_container_ref": null,
                "project_id": "057ef081eb00d2732fd1c01a9be75e6f",
                "sni_container_refs": [],
                "connection_limit": -1,
                "default_pool_id": null,
                "tls_ciphers_policy": null,
                "tags": [],
                "created_at": "2020-11-21T03:09:13Z",
                "updated_at": "2020-11-21T03:09:13Z",
                "http2_enable": false,
                "insert_headers": {
                    "X-Forwarded-ELB-IP": false,
                    "X-Forwarded-Host": true,
                    "X-Forwarded-For-Port": false,
                    "X-Forwarded-Port": false
                },
                "member_timeout": 60,
                "client_timeout": 60,
                "keepalive_timeout": 60,
                "ipgroup": null,
                "enable_member_retry": true,
                "transparent_client_ip_enable": true
            },
            "request_id": "fcd61ee6a6a6c673c65fa0df0577fed9"
        }
      • 请求异常时,错误码请参见 错误码
分享:

    相关文档

    相关产品