你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Add-AzureHDInsightConfigValues

将 Hadoop 配置值自定义或 Hive 共享库自定义添加到 HDInsight 群集配置。

注意

本文档中引用的 cmdlet 用于管理使用 Azure Service Manager (ASM) API 的旧 Azure 资源。 创建新的资源时,不建议使用此旧版 PowerShell 模块,因为 ASM 计划停用。 有关详细信息,请参阅 Azure Service Manager 停用

Az PowerShell 模块是推荐的 PowerShell 模块,用于使用 PowerShell 管理 Azure 资源管理器 (ARM) 资源。

语法

Add-AzureHDInsightConfigValues
   -Config <AzureHDInsightConfig>
   [-Core <Hashtable>]
   [-Yarn <Hashtable>]
   [-Hdfs <Hashtable>]
   [-Hive <AzureHDInsightHiveConfiguration>]
   [-MapReduce <AzureHDInsightMapReduceConfiguration>]
   [-Oozie <AzureHDInsightOozieConfiguration>]
   [-Storm <Hashtable>]
   [-Spark <Hashtable>]
   [-HBase <AzureHDInsightHBaseConfiguration>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

说明

此版本的 Azure PowerShell HDInsight 已弃用。 这些 cmdlet 将于 2017 年 1 月 1 日删除。 请使用较新版本的 Azure PowerShell HDInsight。

有关如何使用新的 HDInsight 创建群集的信息,请参阅 使用 Azure PowerShell 在 HDInsight 中创建基于 Linux 的群集。 有关如何使用 Azure PowerShell 和其他方法提交作业的信息,请参阅 HDInsight 中的提交 Hadoop 作业。 有关 Azure PowerShell HDInsight 的参考信息,请参阅 Azure HDInsight Cmdlet

Add-AzureHDInsightConfigValues cmdlet 将 Hadoop 配置值自定义(例如Core-site.xml或Hive-site.xml)或 Hive 共享库自定义添加到 Azure HDInsight 群集配置。

该 cmdlet 将自定义配置值添加到指定的配置对象。 部署群集时,自定义设置将添加到相关 Hadoop 服务的配置文件中。

示例

示例 1:配置群集

PS C:\>$HiveConfigValues = New-Object 'Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects.AzureHDInsightHiveConfiguration'
PS C:\> $HiveConfigValues.Configuration = @{ hive.exec.compress.output = true }
PS C:\> $HiveConfigValues.AdditionalLibraries = New-Object 'Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects.AzureHDInsightDefaultStorageAccount'
PS C:\> $HiveConfigValues.AdditionalLibraries.StorageAccountName = "MyStorageAccount.blob.core.windows.net"
PS C:\> $HiveConfigValues.AdditionalLibraries.StorageAccountKey = (Get-AzureStorageKey -StorageAccountName "MyStorageAccount").Primary
PS C:\> $HiveConfigValues.AdditionalLibraries.StorageContainerName = "MySharedLibContainer"
PS C:\> $OozieConfigValues = New-Object 'Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects.AzureHDInsightOozieConfiguration'
PS C:\> $OozieConfigValues.Configuration = @{ hive.exec.compress.output = true }
PS C:\> $MapredConfigValues = New-Object 'Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects.AzureHDInsightMapReduceConfiguration'
PS C:\> $MapredConfigValues.Configuration = @{ mapred.map.max.attempts = 2 }
PS C:\> $MapredConfigValues.CapacitySchedulerConfiguration = @{ mapred.capacity-scheduler.init-poll-interval = 1000 }
PS C:\> $Config = New-AzureHDInsightClusterConfig -ClusterSizeInNodes 4
    | Set-AzureHDInsightDefaultStorage -StorageAccountName MyStorageAccount.blob.core.windows.net -StorageAccountKey (Get-AzureStorageKey -StorageAccountName "MyStorageAccount").Primary -StorageContainerName "MyStorageContainer"
    | Add-AzureHDInsightConfigValues -Core @{ io.file.buffer.size = 300000 } -MapReduce $MapredConfigValues -Hive $HiveConfigValues -Oozie $OozieConfigValues
PS C:\> $Config | New-AzureHDInsightCluster -Subscription $SubId -Credential $Creds -Name "MyCluster" -Location "North Europe"

第一个 命令创建新的 AzureHDInsightHiveConfiguration 对象,然后将其存储在$HiveConfigValues变量中。

接下来的五个命令为 Hive 创建配置值,并将这些值存储为$HiveConfigValues的成员。

第七个命令创建一个 AzureHDInsightOozieConfiguration 对象,然后将其存储在$OozieConfigValues变量中。 第八个命令为 Oozie 创建配置值,然后将该值存储为 $OozieConfigValues 的成员。

第九个命令创建 AzureHDInsightMapReduceConfiguration 对象,然后将其存储在$MapredConfigValues变量中。 接下来的两个命令为 MapReduce 创建配置值,并将这些值存储为$MapredConfigValues的成员。

第十二个命令使用 New-AzureHDInsightClusterConfig cmdlet 创建 HDInsight 群集配置,然后将其存储在$Config变量中。 该命令使用管道运算符将$Config 传递给 Set-AzureHDInsightDefaultStorage cmdlet,以更新默认存储设置和 Add-AzureHDInsightConfigValues cmdlet,以将新的配置值添加到群集配置。

最后一个命令使用管道运算符将$Config 传递给 New-AzureHDInsightCluster cmdlet,以使用自定义设置创建新的 HDInsight 群集。

参数

-Config

指定要向其添加 Hadoop 配置的配置对象。

类型:AzureHDInsightConfig
Position:Named
默认值:None
必需:True
Accept pipeline input:True
Accept wildcard characters:False

-Core

为Core-site.xml指定一组 Hadoop 配置值。

类型:Hashtable
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-HBase

为Hbase-site.xml指定一组 HBase 配置值。

类型:AzureHDInsightHBaseConfiguration
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-Hdfs

为Hdfs-site.xml指定一组 Hadoop 配置值。

类型:Hashtable
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-Hive

为 Hadoop Hive 服务指定自定义对象,包括Hive-site.xml和 Hive 共享库的一组 Hadoop 配置值。

类型:AzureHDInsightHiveConfiguration
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-MapReduce

为 MapReduce 和容量计划程序指定自定义对象。

类型:AzureHDInsightMapReduceConfiguration
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-Oozie

为 Hadoop Oozie 服务指定自定义对象,包括Oozie-site.xml的一组 Hadoop 配置值。

类型:AzureHDInsightOozieConfiguration
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-Profile

指定此 cmdlet 从中读取的 Azure 配置文件。 如果未指定配置文件,此 cmdlet 将从本地默认配置文件中读取。

类型:AzureSMProfile
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-Spark

指定 Apache Spark 的自定义对象。

类型:Hashtable
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-Storm

指定 Apache Storm 的自定义对象。

类型:Hashtable
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-Yarn

指定 Hadoop YARN 的自定义对象,为Yarn-site.xml指定一组自定义 YARN 配置值。

类型:Hashtable
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False