湖仓构建 LAKEFORMATION-外部服务接入LakeFormation:操作步骤
操作步骤
- 调用创建实例接口,创建LakeFormation实例,同时记录接口返回的实例Id。
请求示例:
POST https://{endpoint}/v1/{project_id}/instances
Body:
{ "name": "lakeformation", "charge_mode": "postPaid", "shared": "false", "specs": [ { "spec_code": "lakeformation.unit.basic.qps", "stride_num": 1 } ], "enterprise_project_id": "0" }
响应示例:
{ "instance_id": "13677734-a4ee-43e2-9d11-30b8b2e32a95", "name": "lakeformation", "description": "", "enterprise_project_id": "0", "shared": false, "default_instance": false, "create_time": "2023-06-29T09:08:33.000+00:00", "update_time": "2023-06-29T09:08:34.000+00:00", "status": "RESOURCE_PREPARATION", "resource_progress": 25, "resource_expected_duration": 15, "in_recycle_bin": false, "tags": [], "specs": [ { "spec_code": "lakeformation.unit.basic.qps", "stride_num": 1 }, { "spec_code": "lakeformation.unit.basic.metadata", "stride_num": 0 } ] }
- 调用查询实例详情接口,查询实例状态,等待实例状态变为RUNNING运行中,表示实例创建完成。
请求示例:
GET https://{endpoint}/v1/{project_id}/instances/{instance_id}
instance_id:1响应信息中的“instance_id”参数值。
响应示例:
{ "instance_id": "13677734-a4ee-43e2-9d11-30b8b2e32a95", "name": "lakeformation", "description": "", "enterprise_project_id": "0", "shared": false, "default_instance": false, "create_time": "2023-06-29T09:08:33.000+00:00", "update_time": "2023-06-29T09:08:34.000+00:00", "status": "RUNNING", "in_recycle_bin": false, "tags": [], "specs": [ { "spec_code": "lakeformation.unit.basic.qps", "stride_num": 1 }, { "spec_code": "lakeformation.unit.basic.metadata", "stride_num": 0 } ] }
- (可选)如果当前租户首次创建LakeFormation实例,该实例将自动作为默认实例(default)。客户端可以直接访问默认实例,或通过指定具体的实例ID来访问对应的实例。非默认实例可以通过调用设为默认实例接口将非默认实例设为默认实例。
请求示例:
POST https://{endpoint}/v1/{project_id}/instances/{instance_id}/default
instance_id:1响应信息中的“instance_id”参数值。
- 调用创建服务接入客户端接口,选择客户端对应的VPC相关信息创建接入客户端,LakeFormation服务将自动为其创建终端节点和DNS内网 域名 ,用于打通网络连接。
请求示例:
POST https://{endpoint}/v1/{project_id}/instances/{instance_id}/access-clients
instance_id:1响应信息中的“instance_id”参数值。
Body:
{ "name": "access-client", "vpc_id": "131fb837-37ae-4aa6-9e87-312919df659f", "subnet_id": "2fa7ec47-c7f6-4a81-8e77-1dd41121b726" }
响应示例:
{ "id": "b73a9311-1ce9-48fe-b714-21bc41ce7b82", "name": "access-client", "access_mode": "SYSTEM", "status": "CREATING", "vpc_id": "131fb837-37ae-4aa6-9e87-312919df659f", "subnet_id": "2fa7ec47-c7f6-4a81-8e77-1dd41121b726" }
- 调用获取服务接入客户端详情接口,查询接入客户端状态,等待状态变为RUNNING,表示接入客户端创建完成,同时可以在详情中查看接入IP、域名等详细信息。
请求示例:
GET https://{endpoint}/v1/{project_id}/instances/{instance_id}/access-clients/{client_id}
响应示例:
{ "id": "b73a9311-1ce9-48fe-b714-21bc41ce7b82", "name": "access-client", "access_mode": "SYSTEM", "status": "RUNNING", "vpc_id": "131fb837-37ae-4aa6-9e87-312919df659f", "subnet_id": "2fa7ec47-c7f6-4a81-8e77-1dd41121b726", "access_connections": [ { "vpcep_id": "f72c8034-df38-4dbc-bd5d-2f50531ba104", "ip": "10.0.0.6", "owner": "555d9e8999c94705be3d7edb70a3199a", "domain": "xxx.dalf-ed1c-b3070cba-baae-4220-b7ff-9b2bca043efb.apig-lakeformation.com" } ], "create_time": "2023-06-29T12:12:12.000+00:00" }
- 参考目录管理相关接口,使用上述步骤获取的接入IP与实例ID访问元数据管理相关接口,获取目录列表。
请求示例:
GET https://{endpoint}/v1/{project_id}/instances/{instance_id}/catalogs
- endpoint:{instance_id}.lakeformation.lakecat.com,如果已经将实例设为默认实例可以使用default-{project_id}.lakeformation.lakecat.com。
- instance_id:1响应信息中的“instance_id”参数值,如果已经将实例设为默认实例可以直接使用default作为实例ID。
请求头示例
Host:lakeformation.lakecat.com
响应示例:
[ { "catalog_name": "hive", "description": "Default catalog, for Hive", "location": "obs://lakeformation-555d9e8999c94705-xxx/ed1ce787-1671-4ce4-b84f-6f40ccb26752" } ]