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

Add-AzureRmHDInsightMetastore

将SQL 数据库作为 Hive 或 Oozie 元存储添加到群集配置对象。

警告

截至 2024 年 2 月 29 日,AzureRM PowerShell 模块已正式弃用。 为了确保持续获得支持和更新,建议用户从 AzureRM 迁移到 Az PowerShell 模块。

尽管 AzureRM 模块仍可能正常运行,但它不再维护或受支持,但会根据用户的自由裁量权和风险继续使用任何继续使用模块。 有关过渡到 Az 模块的指导,请参阅我们的迁移资源

语法

Add-AzureRmHDInsightMetastore
   [-Config] <AzureHDInsightConfig>
   [-MetastoreType] <AzureHDInsightMetastoreType>
   [-SqlAzureServerName] <String>
   [-DatabaseName] <String>
   [-Credential] <PSCredential>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

说明

Add-AzureRmHDInsightMetastore cmdlet 将 Hive 或 Oozie 元存储添加到 New-AzureRmHDInsightClusterConfig cmdlet 创建的 HDInsight 配置对象。 元存储是一个SQL 数据库,可用于存储 Hive、Oozie 或两者的元数据。

示例

示例 1:将 SQL 数据库元存储添加到群集配置对象

PS C:\># Primary storage account info
PS C:\> $storageAccountResourceGroupName = "Group"
PS C:\> $storageAccountName = "yourstorageacct001"
PS C:\> $storageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value


PS C:\> $storageContainer = "container001"

# Cluster configuration info
PS C:\> $location = "East US 2"
PS C:\> $clusterResourceGroupName = "Group"
PS C:\> $clusterName = "your-hadoop-001"
PS C:\> $clusterCreds = Get-Credential

# If the cluster's resource group doesn't exist yet, run:
#   New-AzureRmResourceGroup -Name $clusterResourceGroupName -Location $location

# Hive metastore info
PS C:\> $hiveSqlServer = "your-sqlserver-001"
PS C:\> $hiveDb = "your-sqldb-001"
PS C:\> $hiveCreds = Get-Credential

# Oozie metastore info
PS C:\> $oozieSqlServer = "your-sqlserver-001"
PS C:\> $oozieDb = "your-sqldb-002"
PS C:\> $oozieCreds = Get-Credential

# Create the cluster
PS C:\> New-AzureRmHDInsightClusterConfig  `
            | Add-AzureRmHDInsightMetastore `
                -SqlAzureServerName "$oozieSqlServer.database.contoso.net" `
                -DatabaseName $oozieDb `
                -Credential $oozieCreds `
                -MetastoreType OozieMetastore `
            | Add-AzureRmHDInsightMetastore `
                -SqlAzureServerName "$hiveSqlServer.database.contoso.net" `
                -DatabaseName $hiveDb `
                -Credential $hiveCreds `
                -MetastoreType HiveMetastore `
            | New-AzureRmHDInsightCluster `
                -ClusterType Hadoop `
                -OSType Windows `
                -ClusterSizeInNodes 4 `
                -ResourceGroupName $clusterResourceGroupName `
                -ClusterName $clusterName `
                -HttpCredential $clusterCreds `
                -Location $location `
                -DefaultStorageAccountName "$storageAccountName.blob.core.contoso.net" `
                -DefaultStorageAccountKey $storageAccountKey `
                -DefaultStorageContainer $storageContainer

此命令将 SQL 数据库元存储添加到名为 your-hadoop-001 的群集。

参数

-Config

指定此 cmdlet 修改的 HDInsight 群集配置对象。 此对象由 New-AzureRmHDInsightClusterConfig cmdlet 创建。

Type:AzureHDInsightConfig
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Credential

指定要用于 AzureSQL 服务器数据库的凭据。

Type:PSCredential
Position:4
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DatabaseName

指定要用于此元存储的 AzureSQL Server 实例上的数据库。

Type:String
Position:3
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

用于与 azure 通信的凭据、帐户、租户和订阅

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MetastoreType

指定元存储的类型。 可能的值为 HiveMetastore 或 OozieMetastore。

Type:AzureHDInsightMetastoreType
Accepted values:HiveMetastore, OozieMetastore
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SqlAzureServerName

指定要用于此元存储的 AzureSQL 服务器实例。

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

输入

AzureHDInsightConfig

参数:配置(ByValue)

输出

AzureHDInsightConfig