【问题标题】:Can not Create HDInsight Cluster in Azure within Virtual Network无法在虚拟网络中的 Azure 中创建 HDInsight 群集
【发布时间】:2016-06-09 21:40:39
【问题描述】:

我尝试在 Azure 中创建 HDInsight Storm 群集并将其添加到我的虚拟网络。但由于某种原因,我总是收到以下错误消息:

集群创建前验证失败:由于用户错误,集群 xxxxxxx 的虚拟网络验证失败验证报告:用户订阅 xxxxxxx 没有任何虚拟网络。例外:

Powershell 脚本如下所示:

####################################
# Set these variables
####################################
$nameToken = "xxxxxx" 

$httpUserName = "xxxxxx"  
$httpPassword = "xxxxxx" 

$ClusterTyp = "Storm"
$namePrefix = $nameToken.ToLower()

$resourceGroupName = $namePrefix
$hdinsightClusterName = $namePrefix +"storm"
$defaultStorageAccountName = $namePrefix +"storm"
$defaultBlobContainerName = $hdinsightClusterName

$location = "North Europe"
$clusterSizeInNodes = 1

#Virtual Network
$NetworkName  = "xxxxxx"
$subnetName = "xxxxxx"

# Treat all errors as terminating
$ErrorActionPreference = "Stop"

###########################################
# Connect to Azure
###########################################
#region - Connect to Azure subscription
Write-Host "`nConnecting to your Azure subscription ..." -ForegroundColor Green
try{Get-AzureRmContext}
catch{Login-AzureRmAccount}
#endregion

###########################################
# Preapre default storage account and container
###########################################
New-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $defaultStorageAccountName -Type Standard_GRS -Location $location

$defaultStorageAccountKey = (Get-AzureRmStorageAccountKey  -ResourceGroupName $resourceGroupName -Name $defaultStorageAccountName).Key1


$defaultStorageContext = New-AzureStorageContext -StorageAccountName $defaultStorageAccountName -StorageAccountKey $defaultStorageAccountKey
New-AzureStorageContainer -Name $hdinsightClusterName -Context $defaultStorageContext 

###########################################
# Create the cluster
###########################################

$vnet = (Get-AzureRmVirtualNetwork -ResourceGroupName $ResourceGroupName -Name $NetworkName).Id
$httpPW = ConvertTo-SecureString -String $httpPassword -AsPlainText -Force
$httpCredential = New-Object System.Management.Automation.PSCredential($httpUserName,$httpPW)
Write-Host "Create HDInsight Cluster" -ForegroundColor Yellow

New-AzureRmHDInsightCluster -ResourceGroupName $resourceGroupName -ClusterName $hdinsightClusterName -Location $location -ClusterSizeInNodes $clusterSizeInNodes -ClusterType $ClusterTyp -OSType Windows -Version "3.2" -HttpCredential $httpCredential -DefaultStorageAccountName "$defaultStorageAccountName.blob.core.windows.net" -DefaultStorageAccountKey $defaultStorageAccountKey -DefaultStorageContainer $hdinsightClusterName  -VirtualNetworkId $vnet -SubnetName $subnetName

Write-Host "HDInsight Cluster Created" -ForegroundColor Green
####################################
# Verify the cluster
####################################
Get-AzureRmHDInsightCluster -ClusterName $hdinsightClusterName 

如果我在没有以下参数的情况下运行脚本,它似乎可以正常工作:

-VirtualNetworkId $vnet -SubnetName $subnetName

当然,如果没有这些参数,集群将不会被添加到虚拟网络中。 虚拟网络肯定存在,如果我在门户中手动添加集群,我可以将其添加到相应的虚拟网络中。

已经感谢您的帮助。

亲切的问候

【问题讨论】:

    标签: powershell azure azure-hdinsight azure-virtual-network


    【解决方案1】:

    使用 ARM 模板要容易得多。您可以从门户、Azure PowerShell 或 CLI 调用 ARM 模板。这是在虚拟网络中创建 HBase 集群的示例。您可以轻松修改模板以创建风暴集群:

    https://azure.microsoft.com/en-us/documentation/articles/hdinsight-hbase-provision-vnet/

    请注意:

    基于 Windows 的集群需要 v1(经典)虚拟网络,而基于 Linux 的集群需要 v2(Azure 资源管理器)虚拟网络。如果您没有正确的网络类型,则在创建集群时将无法使用。见https://azure.microsoft.com/documentation/articles/hdinsight-extend-hadoop-virtual-network/

    【讨论】:

    • 酷完美,与 ARM 模板完美搭配!非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2017-12-09
    • 2021-05-15
    • 2020-07-05
    • 1970-01-01
    • 2021-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多