本文档介绍了如何创建 Dataplex Universal Catalog 数据湖。您可以在支持 Dataplex Universal Catalog 的任何区域中创建数据湖。
准备工作
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Dataplex Universal Catalog, Dataproc, Dataproc Metastore, BigQuery, and Cloud Storage APIs.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Dataplex Universal Catalog, Dataproc, Dataproc Metastore, BigQuery, and Cloud Storage APIs.
如需创建和管理数据湖,请确保您已获得预定义角色
roles/dataplex.admin
或roles/dataplex.editor
。如需了解详情,请参阅授予单个角色。如需将其他项目中的 Cloud Storage 存储桶附加到数据湖,请通过运行以下命令,向以下 Dataplex Universal Catalog 服务账号授予该存储桶的管理员角色:
gcloud alpha dataplex lakes authorize \ --project PROJECT_ID_OF_LAKE \ --storage-bucket-resource BUCKET_NAME
将 Dataproc Metastore 服务实例配置为公开 gRPC 端点(而不是默认的 Thrift Metastore 端点):
curl -X PATCH \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://metastore.googleapis.com/v1beta/projects/PROJECT_ID/locations/LOCATION/services/SERVICE_ID?updateMask=hiveMetastoreConfig.endpointProtocol" \ -d '{"hiveMetastoreConfig": {"endpointProtocol": "GRPC"}}'
查看 gRPC 端点:
gcloud metastore services describe SERVICE_ID \ --project PROJECT_ID \ --location LOCATION \ --format "value(endpointUri)"
在 Google Cloud 控制台中,前往 Dataplex Universal Catalog。
导航到管理视图。
点击
创建。输入显示名称。
系统会自动为您生成数据湖 ID。如果您需要,可以提供自己的 ID。请参阅资源命名惯例。
(可选)输入说明。
指定要在其中创建数据湖的区域。
对于在给定区域(例如
us-central1
)中创建的数据湖,可以附加单区域 (us-central1
) 数据和多区域 (us multi-region
) 数据,具体取决于区域设置。可选:为数据湖添加标签。
可选:在 Metastore 部分中,点击 Metastore 服务菜单,然后选择您在准备工作部分中创建的服务。
点击创建。
LAKE
:新数据湖的名称LOCATION
:指代 Google Cloud 区域k1=v1,k2=v2,k3=v3
:使用的标签(如果有)METASTORE_SERVICE
:Dataproc Metastore 服务(如果已创建)
访问权限控制
创建 metastore
您可以通过将 Dataproc Metastore 服务实例与 Dataplex Universal Catalog 数据湖关联,在 Spark 查询中使用 Hive Metastore 访问 Dataplex Universal Catalog 元数据。您需要有一个与 Dataplex Universal Catalog 数据湖关联的启用了 gRPC 的 Dataproc Metastore(3.1.2 版或更高版本)。
创建数据湖
控制台
gcloud
如需创建数据湖,请使用 gcloud alpha dataplex lakes create
命令:
gcloud alpha dataplex lakes create LAKE \ --location=LOCATION \ --labels=k1=v1,k2=v2,k3=v3 \ --metastore-service=METASTORE_SERVICE
替换以下内容:
REST
如需创建数据湖,请使用 lakes.create 方法。