使用 Amazon Serverless Application Repository 部署 Hive 数据来源连接器 - Amazon Athena
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

使用 Amazon Serverless Application Repository 部署 Hive 数据来源连接器

要部署适用于 Hive 的 Athena 数据来源连接器,您可以使用 Amazon Serverless Application Repository,而不是从 Athena 控制台开始。使用 Amazon Serverless Application Repository 找到要使用的连接器,提供连接器所需的参数,然后将连接器部署到您的账户。部署连接器后,您可以使用 Athena 控制台向 Athena 提供数据来源。

使用 Amazon Serverless Application Repository 将适用于 Hive 的数据来源连接器部署到您的账户
  1. 登录 Amazon Web Services Management Console并打开 Serverless App Repository (无服务器应用程序存储库)

  2. 在导航窗格中,选择 Available applications (可用应用程序)

  3. 选择 Show apps that create custom IAM roles or resource policies(显示创建自定义 IAM 角色或资源策略的应用程序)选项。

  4. 在搜索框中,输入 Hive。显示的连接器包括以下两个:

    • AthenaHiveMetastoreFunction – Uber Lambda 函数 .jar 文件。

    • AthenaHiveMetastoreFunctionWithLayer – Lambda 层和 thin Lambda 函数 .jar 文件。

    这两个应用程序具有相同的功能,仅在实施方面存在差异。您可以使用二者之一创建将 Athena 连接到 Hive 元数据仓的 Lambda 函数。

  5. 选择要使用的连接器名称。本教程使用 AthenaHiveMetastoreFunction

    
                    选择适用于 Hive 的 Athena 数据来源连接器的名称。
  6. Application settings(应用程序设置)中,输入 Lambda 函数的参数。

    • LambdaFuncName – 提供函数的名称。例如,myHiveMetastore

    • SpillLocation – 在此账户中指定 Amazon S3 位置,以便在 Lambda 函数响应大小超过 4 MB 时保存溢出元数据。

    • HMSUris – 输入您的 Hive 元数据仓主机的名称,该主机在端口 9083 使用 Thrift 协议。使用语法 thrift://<host_name>:9083

    • LambdaMemory – 指定从 128 MB 到 3008 MB 的值。Lambda 函数分配与您配置的内存量成比例的 CPU 周期。默认值为 1024。

    • LambdaTimeout – 指定允许的最大 Lambda 调用运行时(以秒为单位),从 1 到 900(900 秒为 15 分钟)。默认值为 300 秒(5 分钟)。

    • VpcSecurityGroupIds – 为 Hive 元数据仓输入一个逗号分隔的 VPC 安全组 ID 列表。

    • VpcSubneIds – 为 Hive 元数据仓输入一个逗号分隔的 VPC 子网 ID 列表。

  7. Application details(应用程序详细信息)页面的右下角,选择 I acknowledge that this app creates custom IAM roles(我确认此应用程序创建自定义 IAM 角色),然后选择 Deploy(部署)。

此时,您可以将 Athena 配置为使用 Lambda 函数连接到 Hive 元数据仓。要查看步骤,请参阅 配置 Athena 使用部署的 Hive 元存储连接器