使用 Apache Hadoop、Apache Spark、Apache Kafka 及其他组件在 HDInsight 中设置群集Set up clusters in HDInsight with Apache Hadoop, Apache Spark, Apache Kafka, and more

了解如何使用 Apache Hadoop、Apache Spark、Apache Kafka、交互式查询、Apache HBase 或 Apache Storm 在 HDInsight 中设置和配置群集。Learn how to set up and configure clusters in HDInsight with Apache Hadoop, Apache Spark, Apache Kafka, Interactive Query, Apache HBase, ML Services, or Apache Storm. 另外,了解如何自定义群集,并将它们加入域以提高安全性。Also, learn how to customize clusters and add security by joining them to a domain.

Hadoop 群集由用于对任务进行分布式处理的多个虚拟机(节点)组成。A Hadoop cluster consists of several virtual machines (nodes) that are used for distributed processing of tasks. Azure HDInsight 对各个节点的安装和配置的实现细节进行处理,因此你只需提供常规配置信息。Azure HDInsight handles implementation details of installation and configuration of individual nodes, so you only have to provide general configuration information.

Important

HDInsight 群集计费在创建群集之后便会开始,删除群集后才会停止。HDInsight cluster billing starts once a cluster is created and stops when the cluster is deleted. HDInsight 群集按分钟收费,因此不再需要使用群集时,应将其删除。Billing is pro-rated per minute, so you should always delete your cluster when it is no longer in use. 了解如何删除群集Learn how to delete a cluster.

群集设置方法Cluster setup methods

下表显示了可用于设置 HDInsight 群集的不同方法。The following table shows the different methods you can use to set up an HDInsight cluster.

群集创建方法Clusters created with Web 浏览器Web browser 命令行Command line REST APIREST API SDKSDK
Azure 门户Azure portal      
Azure CLIAzure CLI      
Azure PowerShellAzure PowerShell      
cURLcURL    
.NET SDK.NET SDK      
Azure Resource Manager 模板Azure Resource Manager templates      

快速创建:基本群集设置Quick create: Basic cluster setup

本文逐步讲解如何通过 Azure 门户进行设置:在门户中使用“快速创建”或“自定义”选项创建 HDInsight 群集。 This article walks you through setup in the Azure portal, where you can create an HDInsight cluster using Quick create or Custom. hdinsight 创建选项 - 自定义快速创建hdinsight create options custom quick create

遵照屏幕上的说明执行基本的群集设置。Follow instructions on the screen to do a basic cluster setup. 下面提供了各项设置的详细信息:Details are provided below for:

资源组名称Resource group name

可以借助 Azure Resource Manager 以组(称为 Azure 资源组)的形式处理应用程序中的资源。Azure Resource Manager helps you work with the resources in your application as a group, referred to as an Azure resource group. 可以通过单个协调的操作来部署、更新、监视或删除应用程序的所有资源。You can deploy, update, monitor, or delete all the resources for your application in a single coordinated operation.

群集类型和配置Cluster types and configuration

Azure HDInsight 目前提供以下群集类型,每种类型都具有一组用于提供特定功能的组件。Azure HDInsight currently provides the following cluster types, each with a set of components to provide certain functionalities.

Important

HDInsight 群集以多种类型提供,每种类型适用于单个工作负荷或技术。HDInsight clusters are available in various types, each for a single workload or technology. 不支持在一个群集上创建合并了多个类型(如 Storm 和 HBase)的群集。There is no supported method to create a cluster that combines multiple types, such as Storm and HBase on one cluster. 如果解决方案需要分布在多种 HDInsight 群集类型上的技术,可以使用 Azure 虚拟网络 连接所需的群集类型。If your solution requires technologies that are spread across multiple HDInsight cluster types, an Azure virtual network can connect the required cluster types.

群集类型Cluster type 功能Functionality
HadoopHadoop Batch 查询和存储数据的分析Batch query and analysis of stored data
HBaseHBase 大量无架构 NoSQL 数据的处理Processing for large amounts of schemaless, NoSQL data
交互式查询Interactive Query 更快的交互式 Hive 查询的内存中缓存In-memory caching for interactive and faster Hive queries
KafkaKafka 分布式流式处理平台,可用于构建实时流数据管道和应用程序A distributed streaming platform that can be used to build real-time streaming data pipelines and applications
SparkSpark 内存中处理、交互式查询、微批流处理In-memory processing, interactive queries, micro-batch stream processing
StormStorm 实时事件处理Real-time event processing

HDInsight 版本HDInsight version

选择此群集的 HDInsight 版本。Choose the version of HDInsight for this cluster. 有关详细信息,请参阅支持的 HDInsight 版本For more information, see Supported HDInsight versions.

群集登录名和 SSH 用户名Cluster login and SSH user name

使用 HDInsight 群集时,可以在群集创建期间配置两个用户帐户:With HDInsight clusters, you can configure two user accounts during cluster creation:

  • HTTP 用户:默认的用户名为 admin。它使用 Azure 门户上的基本配置。HTTP user: The default username is admin. It uses the basic configuration on the Azure portal. 有时称为“群集用户”。Sometimes it is called "Cluster user."
  • SSH 用户:用来通过 SSH 连接到群集。SSH user: Used to connect to the cluster through SSH. 有关详细信息,请参阅 将 SSH 与 HDInsight 配合使用For more information, see Use SSH with HDInsight.

使用企业安全包可将 HDInsight 与 Active Directory 和 Apache Ranger 集成。The Enterprise security package allows you to integrate HDInsight with Active Directory and Apache Ranger. 可使用企业安全数据包创建多个用户。Multiple users can be created using the Enterprise security package.

群集和存储的位置(区域)Location (regions) for clusters and storage

不需要显式指定群集位置:群集与默认存储在相同的位置。You don't need to specify the cluster location explicitly: The cluster is in the same location as the default storage. 有关受支持区域的列表,请单击 HDInsight 定价中的“区域”下拉列表。 For a list of supported regions, click the Region drop-down list on HDInsight pricing.

群集的存储终结点Storage endpoints for clusters

Hadoop 的本地安装对群集上的存储使用 Hadoop 分布式文件系统 (HDFS),而在云中,需使用已连接到群集的存储终结点。Although an on-premises installation of Hadoop uses the Hadoop Distributed File System (HDFS) for storage on the cluster, in the cloud you use storage endpoints connected to cluster. HDInsight 群集使用 Azure 存储中的 BlobHDInsight clusters use blobs in Azure Storage. 使用 Azure 存储意味着可以安全删除用于计算的 HDInsight 群集,同时仍可保留数据。Using Azure Storage means you can safely delete the HDInsight clusters used for computation while still retaining your data.

Warning

不支持在 HDInsight 群集之外的其他位置使用其他存储帐户。Using an additional storage account in a different location from the HDInsight cluster is not supported.

在配置期间,请为默认存储终结点指定 Azure 存储帐户的某个 Blob 容器。During configuration, for the default storage endpoint you specify a blob container of an Azure Storage account. 默认存储包含应用程序日志和系统日志。The default storage contains application and system logs. 也可以选择指定群集可访问的其他 Azure 存储链接帐户。Optionally, you can specify additional linked Azure Storage accounts that the cluster can access. HDInsight 群集和相关的存储帐户必须在同一个 Azure 位置。The HDInsight cluster and the dependent storage accounts must be in the same Azure location.

群集存储设置:与 HDFS 兼容的存储终结点

Note

需要安全传输的功能强制通过安全连接来实施针对帐户的所有请求。The feature that requires secure transfer enforces all requests to your account through a secure connection. 仅 HDInsight 群集 3.6 或更高版本支持此功能。Only HDInsight cluster version 3.6 or newer supports this feature. 有关详细信息,请参阅在 Azure HDInsight 中使用安全传输存储帐户创建 Apache Hadoop 群集For more information, see Create Apache Hadoop cluster with secure transfer storage accounts in Azure HDInsight.

可选元存储Optional metastores

你可以创建可选的 Hive 或 Apache Oozie 元存储。You can create optional Hive or Apache Oozie metastores. 但是,并非所有群集类型都支持元存储,并且 Azure SQL 数据仓库与元存储不兼容。However, not all cluster types support metastores, and Azure SQL Data Warehouse isn't compatible with metastores.

有关详细信息,请参阅在 Azure HDInsight 中使用外部元数据存储For more information, see Use external metadata stores in Azure HDInsight.

Important

创建自定义元存储时,请不要在数据库名称中使用破折号、连字符或空格。When you create a custom metastore, don't use dashes, hyphens, or spaces in the database name. 否则可能导致群集创建过程失败。This can cause the cluster creation process to fail.

Hive 元存储Hive metastore

如果希望在删除 HDInsight 群集后保留 Hive 表,请使用自定义元存储。If you want to retain your Hive tables after you delete an HDInsight cluster, use a custom metastore. 这样,便可以将该元存储附加到另一个 HDInsight 群集。You can then attach the metastore to another HDInsight cluster.

为一个 HDInsight 群集版本创建的 HDInsight 元存储不能在不同的 HDInsight 群集版本之间共享。An HDInsight metastore that is created for one HDInsight cluster version cannot be shared across different HDInsight cluster versions. 有关 HDInsight 版本的列表,请参阅支持的 HDInsight 版本For a list of HDInsight versions, see Supported HDInsight versions.

Oozie 元存储Oozie metastore

若要提高使用 Oozie 时的性能,请使用自定义元存储。To increase performance when using Oozie, use a custom metastore. 删除群集后,元存储也可提供对 Oozie 作业数据的访问权限。A metastore can also provide access to Oozie job data after you delete your cluster.

Important

无法重用自定义 Oozie 元存储。You cannot reuse a custom Oozie metastore. 若要使用自定义 Oozie 元存储,必须在创建 HDInsight 群集时提供一个空的 Azure SQL 数据库。To use a custom Oozie metastore, you must provide an empty Azure SQL Database when creating the HDInsight cluster.

自定义群集设置Custom cluster setup

“自定义群集设置”是在“快速创建”设置的基础之上实现的,其中添加了以下选项:Custom cluster setup builds on the Quick create settings, and adds the following options:

在群集上安装 HDInsight 应用程序Install HDInsight applications on clusters

HDInsight 应用程序是用户可以在基于 Linux 的 HDInsight 群集上安装的应用程序。An HDInsight application is an application that users can install on a Linux-based HDInsight cluster. 可以使用 Microsoft、第三方提供的应用程序。You can use applications provided by Microsoft, third parties.

大多数 HDInsight 应用程序安装在空边缘节点上。Most of the HDInsight applications are installed on an empty edge node. 空边缘节点是安装并配置了与头节点中相同的客户端工具的 Linux 虚拟机。An empty edge node is a Linux virtual machine with the same client tools installed and configured as in the head node. 可以使用该边缘节点来访问群集、测试客户端应用程序和托管客户端应用程序。You can use the edge node for accessing the cluster, testing your client applications, and hosting your client applications. 有关详细信息,请参阅在 HDInsight 中使用空边缘节点For more information, see Use empty edge nodes in HDInsight.

配置群集大小Configure cluster size

只要群集存在,就会产生节点使用费。You are billed for node usage for as long as the cluster exists. 创建群集后便开始计费,删除群集后停止计费。Billing starts when a cluster is created and stops when the cluster is deleted. 无法取消分配群集或将其置于暂停状态。Clusters can't be de-allocated or put on hold.

每个群集类型的节点数Number of nodes for each cluster type

每个群集类型有自身的节点数目、节点术语和默认的 VM 大小。Each cluster type has its own number of nodes, terminology for nodes, and default VM size. 下表中的括号内列出了每个节点类型的节点数目。In the following table, the number of nodes for each node type is in parentheses.

类型Type NodesNodes 图示Diagram
HadoopHadoop 头节点 (2)、工作器节点 (1+)Head node (2), Worker node (1+) HDInsight Hadoop 群集节点
HBaseHBase 头服务器 (2),区域服务器 (1+),主控/ZooKeeper 节点 (3)Head server (2), region server (1+), master/ZooKeeper node (3) HDInsight HBase 群集节点
StormStorm Nimbus 节点 (2),监督程序服务器 (1+),ZooKeeper 节点 (3)Nimbus node (2), supervisor server (1+), ZooKeeper node (3) HDInsight Storm 群集节点
SparkSpark 头节点 (2),辅助角色节点 (1+),ZooKeeper 节点 (3)(对于 A1 ZooKeeper VM 大小免费)Head node (2), worker node (1+), ZooKeeper node (3) (free for A1 ZooKeeper VM size) HDInsight Spark 群集节点

有关详细信息,请参阅“HDInsight 中的 Hadoop 组件和版本是什么?”中的群集的默认节点配置和虚拟机大小For more information, see Default node configuration and virtual machine sizes for clusters in "What are the Hadoop components and versions in HDInsight?"

HDInsight 群集的成本取决于节点数和节点的虚拟机大小。The cost of HDInsight clusters is determined by the number of nodes and the virtual machines sizes for the nodes.

不同群集类型具有不同的节点类型、节点数和节点大小:Different cluster types have different node types, numbers of nodes, and node sizes:

  • Hadoop 群集类型的默认配置:Hadoop cluster type default:
    • 两个头节点 Two head nodes
    • 四个工作器节点 Four Worker nodes
  • Storm 群集类型的默认配置:Storm cluster type default:
    • 两个 Nimbus 节点 Two Nimbus nodes
    • 三个 ZooKeeper 节点 Three ZooKeeper nodes
    • 四个监督器节点 Four supervisor nodes

如果你只是想要试用 HDInsight,我们建议你使用一个工作器节点。If you are just trying out HDInsight, we recommend you use one Worker node. 有关 HDInsight 定价的详细信息,请参阅 HDInsight 定价For more information about HDInsight pricing, see HDInsight pricing.

Note

群集大小限制因 Azure 订阅而异。The cluster size limit varies among Azure subscriptions. 可联系 Azure 支持部门以提高限制。Contact Azure Support to increase the limit.

使用 Azure 门户配置群集时,可通过“节点定价层” 边栏选项卡查看节点大小。When you use the Azure portal to configure the cluster, the node size is available through the Node Pricing Tiers blade. 在门户中,还可以查看不同节点大小的相关费用。In the portal, you can also see the cost associated with the different node sizes.

HDInsight VM 节点大小

虚拟机大小Virtual machine sizes

部署群集时,请根据要部署的解决方案选择计算资源。When you deploy clusters, choose compute resources based on the solution you plan to deploy. 以下 VM 用于 HDInsight 群集:The following VMs are used for HDInsight clusters:

使用不同的 SDK 或使用 Azure PowerShell 创建群集时,若要确定应该使用哪个值来指定 VM 大小,请参阅用于 HDInsight 群集的 VM 大小To find out what value you should use to specify a VM size while creating a cluster using the different SDKs or while using Azure PowerShell, see VM sizes to use for HDInsight clusters. 请使用此链接本章的“大小”列中的值。 From this linked article, use the value in the Size column of the tables.

Important

如果需要在群集中使用 32 个以上的辅助角色节点,则必须选择至少具有 8 个核心和 14 GB RAM 的头节点大小。If you need more than 32 worker nodes in a cluster, you must select a head node size with at least 8 cores and 14 GB of RAM.

有关详细信息,请参阅虚拟机的大小For more information, see Sizes for virtual machines. 有关不同大小的定价信息,请参阅 HDInsight 定价For information about pricing of the various sizes, see HDInsight pricing.

高级设置:脚本操作Advanced settings: Script actions

可以在创建期间通过使用脚本安装其他组件或自定义群集配置。You can install additional components or customize cluster configuration by using scripts during creation. 此类脚本可通过 脚本操作调用,脚本操作是一种配置选项,可通过 Azure 门户、HDInsight Windows PowerShell cmdlet 或 HDInsight .NET SDK 使用。Such scripts are invoked via Script Action, which is a configuration option that can be used from the Azure portal, HDInsight Windows PowerShell cmdlets, or the HDInsight .NET SDK. 有关详细信息,请参阅使用脚本操作自定义 HDInsight 群集For more information, see Customize HDInsight cluster using Script Action.

某些本机 Java 组件(例如 Apache Mahout 和 Cascading)可以在群集上作为 Java 存档 (JAR) 文件运行。Some native Java components, like Apache Mahout and Cascading, can be run on the cluster as Java Archive (JAR) files. 可以使用 Hadoop 作业提交机制将这些 JAR 文件分发到 Azure 存储,然后提交到 HDInsight 群集。These JAR files can be distributed to Azure Storage and submitted to HDInsight clusters with Hadoop job submission mechanisms. 有关详细信息,请参阅以编程方式提交 Apache Hadoop 作业For more information, see Submit Apache Hadoop jobs programmatically.

Note

如果在将 JAR 文件部署到 HDInsight 群集或调用 HDInsight 群集上的 JAR 文件时遇到问题,请联系 Azure 支持If you have issues deploying JAR files to HDInsight clusters, or calling JAR files on HDInsight clusters, contact Azure Support.

HDInsight 不支持级联,因此不符合 Azure 技术支持的条件。Cascading is not supported by HDInsight and is not eligible for Azure Support. 有关支持的组件的列表,请参阅 HDInsight 提供的群集版本有哪些新功能?For lists of supported components, see What's new in the cluster versions provided by HDInsight.

在创建过程中,有时需要配置以下配置文件:Sometimes, you want to configure the following configuration files during the creation process:

  • clusterIdentity.xmlclusterIdentity.xml
  • core-site.xmlcore-site.xml
  • gateway.xmlgateway.xml
  • hbase-env.xmlhbase-env.xml
  • hbase-site.xmlhbase-site.xml
  • hdfs-site.xmlhdfs-site.xml
  • hive-env.xmlhive-env.xml
  • hive-site.xmlhive-site.xml
  • mapred-sitemapred-site
  • oozie-site.xmloozie-site.xml
  • oozie-env.xmloozie-env.xml
  • storm-site.xmlstorm-site.xml
  • tez-site.xmltez-site.xml
  • webhcat-site.xmlwebhcat-site.xml
  • yarn-site.xmlyarn-site.xml

有关详细信息,请参阅 使用 Bootstrap 自定义 HDInsight 群集 For more information, see Customize HDInsight clusters using Bootstrap.

高级设置:使用虚拟网络扩展群集Advanced settings: Extend clusters with a virtual network

如果解决方案需要分布在多种 HDInsight 群集类型上的技术,可以使用 Azure 虚拟网络 连接所需的群集类型。If your solution requires technologies that are spread across multiple HDInsight cluster types, an Azure virtual network can connect the required cluster types. 此配置允许群集以及部署到群集的任何代码直接相互通信。This configuration allows the clusters, and any code you deploy to them, to directly communicate with each other.

有关将 Azure 虚拟网络与 HDInsight 配合使用的详细信息,请参阅使用 Azure 虚拟网络扩展 HDInsightFor more information on using an Azure virtual network with HDInsight, see Extend HDInsight with Azure virtual networks.

有关在一个 Azure 虚拟网络中使用两种群集类型的示例,请参阅将 Apache Spark 结构化流式处理与 Apache Kafka 配合使用For an example of using two cluster types within an Azure virtual network, see Use Apache Spark Structured Streaming with Apache Kafka. 有关将 HDInsight 与虚拟网络配合使用的详细信息(包括虚拟网络的特定配置要求),请参阅 Extend HDInsight capabilities by using Azure Virtual Network(使用 Azure 虚拟网络扩展 HDInsight 功能)。For more information about using HDInsight with a virtual network, including specific configuration requirements for the virtual network, see Extend HDInsight capabilities by using Azure Virtual Network.

后续步骤Next steps