Managed Service for Apache Spark 可选的 Presto 组件

使用 可选组件 功能创建 Managed Service for Apache Spark 集群时,您可以安装 Presto 等其他组件。本页面介绍了如何在 Managed Service for Apache Spark 集群上选择安装 Presto 组件。

Presto (Trino) 是一个开源 分布式 SQL 查询引擎。默认情况下,集群的第一个主节点上的端口 8060(如果已启用 Kerberos,则为端口 7778)上会提供 Presto 服务器和网页界面。

默认情况下,Managed Service for Apache Spark 上的 Presto 配置为使用 HiveBigQueryMemoryTPCHTPCDS 连接器

使用 Presto 组件创建集群后,您可以运行查询:

安装组件

创建 Managed Service for Apache Spark 集群时,请安装该组件。 组件可添加到使用 Managed Service for Apache Spark 版本 1.3 及更高版本创建的集群中。

如需查看每个 Managed Service for Apache Spark 映像版本中包含的组件版本,请参阅 支持的 Managed Service for Apache Spark 版本

Google Cloud 控制台

  1. 在 Google Cloud 控制台中,打开 创建集群 页面。
  2. 点击其他配置 以展开该部分。
  3. 修改可选组件
  4. 在打开的面板中,选中 Presto 对应的复选框。

gcloud CLI 命令

如需创建包含 Presto 组件的 Managed Service for Apache Spark 集群, 请使用 gcloud dataproc clusters create cluster-name 命令以及 --optional-components 标志。

gcloud dataproc clusters create cluster-name \
    --optional-components=PRESTO \
    --region=region \
    --enable-component-gateway \
    ... other flags

配置属性

--properties 标志添加到 gcloud dataproc clusters create 命令以设置 Presto、presto-jvm 和 Presto - 目录记录配置属性。

  • 应用属性:使用具有 presto: 前缀的集群属性来配置 Presto 应用属性,例如 --properties="presto:join-distribution-type=AUTOMATIC"
  • JVM 配置属性:使用具有 presto-jvm: 前缀的集群属性为 Presto 协调器和工作器 Java 进程(例如,--properties="presto-jvm:XX:+HeapDumpOnOutOfMemoryError")配置值和时间。
  • 创建新目录并添加目录属性:使用 presto-catalog:catalog-name.property-name 配置 Presto 目录。

    示例:以下“properties”标志可与“gcloud dataproc clusters create”命令结合使用,以创建具有“prodhive”Hive 目录的 Presto 集群。系统将在 /usr/lib/presto/etc/catalog/ 下创建一个 prodhive.properties 文件,以启用正式目录。

    --properties="presto-catalog:prodhive.connector.name=hive-hadoop2,presto-catalog:prodhive.hive.metastore.uri=thrift://localhost:9083

REST API

可以通过 Dataproc API 使用 SoftwareConfig.Component 将 Presto 组件指定为 clusters.create 请求的一部分。