我尝试在Azure中创建一个HDInsight风暴集群,并将其添加到我的虚拟网络中。但出于某种原因,我总是收到以下错误消息:
群集创建前验证失败:由于用户errorValidation报告,群集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
当然,如果没有这些参数,集群将不会添加到虚拟网络中。虚拟网络确实存在,如果我在门户中手动添加集群,则可以将其添加到相应的虚拟网络中。
谢谢你的帮助。
亲切问候
发布于 2016-06-04 21:49:59
使用ARM模板要容易得多。您可以从门户、Azure PowerShell或CLI调用ARM模板。下面是一个在虚拟网络中创建HBase集群的示例。您可以轻松地修改模板以创建风暴集群:
https://azure.microsoft.com/en-us/documentation/articles/hdinsight-hbase-provision-vnet/
请注意:
基于Windows的集群需要一个v1 (经典)虚拟网络,而基于Linux的集群需要一个v2 (,)虚拟网络。如果您没有正确的网络类型,则在创建群集时它将不可用。请参阅https://azure.microsoft.com/documentation/articles/hdinsight-extend-hadoop-virtual-network/
https://stackoverflow.com/questions/37631206
复制相似问题