如需在 Managed Service for Apache Spark 集群节点上运行 Docker 容器,请在创建集群期间启用 Docker 可选组件。本文档介绍了如何在 Managed Service for Apache Spark 上安装和配置 Docker 组件。
如需详细了解 Managed Service for Apache Spark 中其他可用的可选组件,请参阅可用的可选组件。
Docker 组件的运作方式
启用 Managed Service for Apache Spark Docker 组件后,系统会在每个集群节点上安装一个 Docker 守护程序。它还在每个节点上设置了一个 Linux 用户和组(均名为“docker”),以运行 Docker 守护程序。此外,该组件还会创建一个“docker”systemd 服务以运行 dockerd 服务。建议您使用此 systemd 服务来管理 Docker 服务的生命周期。
安装组件
在创建 Managed Service for Apache Spark 集群时安装该组件。 可以将 Docker 组件安装在使用 Managed Service for Apache Spark 映像版本 1.5 或更高版本创建的集群上。
如需查看每个 Managed Service for Apache Spark 映像版本中包含的组件版本,请参阅支持的 Managed Service for Apache Spark 版本。
Google Cloud 控制台
- 在 Google Cloud 控制台中,打开创建集群页面。
- 点击其他配置以展开该部分。
- 修改可选组件。
- 在随即打开的面板中,选中 Docker 的复选框,然后点击保存。
gcloud CLI
如需创建包含 Docker 组件的 Managed Service for Apache Spark 集群,请使用带有 --optional-components 标志的 gcloud dataproc clusters create cluster-name 命令。
gcloud dataproc clusters create cluster-name \ --optional-components=DOCKER \ --region=region \ --image-version=1.5 \ ... other flags
REST API
可以通过 Dataproc API 使用 SoftwareConfig.Component 将 Docker 组件指定为 clusters.create 请求的一部分。
启用 Docker on YARN
如需将自定义的 Docker 映像与 YARN 搭配使用,请参阅使用 Docker on YARN 自定义 Spark 作业运行时环境。
Docker 日志记录
默认情况下,Managed Service for Apache Spark Docker 组件通过设置 gcplogs driver 将日志写入 Cloud Logging,请参阅查看日志。
Docker 注册表
除了默认的 Docker 注册表外,Managed Service for Apache Spark Docker 组件还会将 Docker 配置为使用 Container Registry。Docker 将使用 Docker 凭据帮助程序向 Container Registry 进行身份验证。
使用 Kerberos 集群上的 Docker 组件
您可以将 Docker 可选组件安装在已启用 Kerberos 安全的情况下所创建的集群上。