Google Cloud Storage 设置

Driverless AI 让您能从 Driverless AI 应用程序内探索 Google Cloud Storage 数据源。本节介绍如何配置 Driverless AI 与 Google Cloud Storage 配合使用。此项设置要求您启用身份验证。如果您启用 GCS 或 GBQ 连接器,则这些文件系统将在 UI 中提供,但如果未经身份验证,您将无法使用这些连接器。

若需启用经身份验证的 GCS 数据连接器,您必须:

  1. 从`GCP <https://cloud.google.com/iam/docs/creating-managing-service-account-keys>` 获取 JSON 身份验证文件。

  2. 将 JSON 文件挂载至 Docker 实例。

  3. 在 gcs_path_to_service_account_json 配置选项中指定 /json_auth_file.json 的路径。

请注意

  • 服务帐户 JSON 中包含由系统管理员提供的身份验证。您将获得一份 JSON 文件,其中可能包含 Google Cloud Storage 和 Google BigQuery 身份验证信息,也可能仅包含其中一个或都不包含。

  • 根据您所安装的 Docker 版本,在启动 Driverless AI Docker 映像时,使用 docker run --runtime=nvidia (>= Docker 19.03) 或 nvidia-docker (< Docker 19.03) 命令。使用 docker version 来检查您使用的 Docker 版本。

配置属性说明

  • gcs_path_to_service_account_json: 指定 /json_auth_file.json 文件的路径。

  • gcs_init_path: 指定在 GCS 浏览器 UI 中显示的 GCS 启动路径。

启动有身份验证的 GCS

本示例通过传递 JSON 身份验证文件启用经身份验证的 GCS 数据连接器。这假设 JSON 文件包含 Google Cloud Storage 身份验证。

nvidia-docker run \
    --pid=host \
    --init \
    --rm \
    --shm-size=256m \
    -e DRIVERLESS_AI_ENABLED_FILE_SYSTEMS="file,gcs" \
    -e DRIVERLESS_AI_GCS_PATH_TO_SERVICE_ACCOUNT_JSON="/service_account_json.json" \
    -u `id -u`:`id -g` \
    -p 12345:12345 \
    -v `pwd`/data:/data \
    -v `pwd`/log:/log \
    -v `pwd`/license:/license \
    -v `pwd`/tmp:/tmp \
    -v `pwd`/service_account_json.json:/service_account_json.json \
    h2oai/dai-centos7-x86_64:1.9.2.1-cuda10.0.xx

本示例展示如何在 config.toml 文件中配置 GCS 数据连接器选项,然后在 Docker 中启动 Driverless AI 时指定此文件。

  1. 配置 Driverless AI config.toml 文件。设置以下配置选项:

  • enabled_file_systems = "file, upload, gcs"

  • gcs_path_to_service_account_json = "/service_account_json.json"

  1. 将 config.toml 文件挂载至 Docker 容器。

nvidia-docker run \
  --pid=host \
  --init \
  --rm \
  --shm-size=256m \
  --add-host name.node:172.16.2.186 \
  -e DRIVERLESS_AI_CONFIG_FILE=/path/in/docker/config.toml \
  -p 12345:12345 \
  -v /local/path/to/config.toml:/path/in/docker/config.toml \
  -v /etc/passwd:/etc/passwd:ro \
  -v /etc/group:/etc/group:ro \
  -v /tmp/dtmp/:/tmp \
  -v /tmp/dlog/:/log \
  -v /tmp/dlicense/:/license \
  -v /tmp/ddata/:/data \
  -u $(id -u):$(id -g) \
  h2oai/dai-centos7-x86_64:1.9.2.1-cuda10.0.xx

本示例通过传递 JSON 身份验证文件启用经身份验证的 GCS 数据连接器。这假设 JSON 文件包含 Google Cloud Storage 身份验证。

  1. 导出 Driverless AI config.toml 文件或将其添加至 ~/.bashrc。例如:

# DEB and RPM
export DRIVERLESS_AI_CONFIG_FILE="/etc/dai/config.toml"

# TAR SH
export DRIVERLESS_AI_CONFIG_FILE="/path/to/your/unpacked/dai/directory/config.toml"
  1. 在 config.toml 文件中指定以下配置选项。

# File System Support
# upload : standard upload feature
# file : local file system/server file system
# hdfs : Hadoop file system, remember to configure the HDFS config folder path and keytab below
# dtap : Blue Data Tap file system, remember to configure the DTap section below
# s3 : Amazon S3, optionally configure secret and access key below
# gcs : Google Cloud Storage, remember to configure gcs_path_to_service_account_json below
# gbq : Google Big Query, remember to configure gcs_path_to_service_account_json below
# minio : Minio Cloud Storage, remember to configure secret and access key below
# snow : Snowflake Data Warehouse, remember to configure Snowflake credentials below (account name, username, password)
# kdb : KDB+ Time Series Database, remember to configure KDB credentials below (hostname and port, optionally: username, password, classpath, and jvm_args)
# azrbs : Azure Blob Storage, remember to configure Azure credentials below (account name, account key)
# jdbc: JDBC Connector, remember to configure JDBC below. (jdbc_app_configs)
# hive: Hive Connector, remember to configure Hive below. (hive_app_configs)
# recipe_url: load custom recipe from URL
# recipe_file: load custom recipe from local file system
enabled_file_systems = "file, gcs"

# GCS Connector credentials
# example (suggested) -- "/licenses/my_service_account_json.json"
gcs_path_to_service_account_json = "/service_account_json.json"
  1. 完成后,保存更改,然后停止/重启 Driverless AI。