S3 设置

Driverless AI 允许您在 Driverless AI 应用程序内搜索 S3 数据源。本节介绍如何配置 Driverless AI 与 S3 配合使用。

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

配置属性说明

  • aws_access_key_id: S3 访问密钥 ID。

  • aws_secret_access_key: S3 访问密钥。

  • aws_role_arn: Amazon 资源名称

  • aws_default_region: 当没有设置 aws_s3_endpoint_url 选项时需使用的区域。当已设置 aws_s3_endpoint_url 时,会忽略此区域。

  • aws_s3_endpoint_url: 用于访问 S3 的端点 URL。

  • aws_use_ec2_role_credentials: 如果设置为 true,S3 连接器会尝试获取与附加给 EC2 实例的角色相关的凭据。

  • s3_init_path: UI S3 浏览器中将显示的起始 S3 路径。

  • enabled_file_systems: 您要启用的文件系统。为使数据连接器正常运行,必须进行此项配置。

示例 1:启用无身份验证的 S3。

此示例启用了 S3 数据连接器,并禁用了身份验证。其并不传递任何 S3 访问密钥或密码,但会通过传递 S3 名称节点的名称和 IP 地址来配置 Docker DNS。这允许用户直接使用名称节点地址(如 s3://name.node/datasets/iris.csv)引用 S3 中储存的数据。

nvidia-docker run \
      --shm-size=256m \
      --add-host name.node:172.16.2.186 \
      -e DRIVERLESS_AI_ENABLED_FILE_SYSTEMS="file,s3" \
      -p 12345:12345 \
      --init -it --rm \
      -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

此示例展示了如何在 config.toml 文件中配置 S3 选项,然后当在 Docker 中启动 Driverless AI 时指定此文件。请注意,本示例启用了无身份验证的 S3。

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

  • enabled_file_systems = "file, upload, s3"

  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

此示例启用了 S3 数据连接器,并禁用了身份验证。其并不传递任何 S3 访问密钥或密码。

  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, s3"
  1. 完成后,保存更改,然后停止/重启 Driverless AI。

示例 2:启用有身份验证的 S3。

此示例通过传递 S3 访问密钥 ID 和访问密钥来启用 S3 数据连接器。其通过传递 S3 名称节点的名称和 IP 地址来配置 Docker DNS。这允许用户直接使用名称节点地址(如 s3://name.node/datasets/iris.csv)引用 S3 中储存的数据。

nvidia-docker run \
        --shm-size=256m \
        --add-host name.node:172.16.2.186 \
        -e DRIVERLESS_AI_ENABLED_FILE_SYSTEMS="file,s3" \
        -e DRIVERLESS_AI_AWS_ACCESS_KEY_ID="<access_key_id>" \
        -e DRIVERLESS_AI_AWS_SECRET_ACCESS_KEY="<access_key>" \
        -p 12345:12345 \
        --init -it --rm \
        -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

此示例展示了如何在 config.toml 文件中配置有身份验证的 S3 选项并在于 Docker 中启动 Driverless AI 时指定该文件。

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

  • enabled_file_systems = "file, upload, s3"

  • aws_access_key_id = "<access_key_id>"

  • aws_secret_access_key = "<access_key>"

  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

此示例通过传递 S3 访问密钥 ID 和访问密钥启用有身份验证的 S3 数据连接器。

  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, s3"

# S3 Connector credentials
aws_access_key_id = "<access_key_id>"
aws_secret_access_key = "<access_key>"
  1. 完成后,保存更改,然后停止/重启 Driverless AI。