我尝试在Azure中创建一个HDInsight Storm Cluster并将其添加到我的虚拟网络中。但由于某种原因,我总是收到以下错误消息:
预群集创建验证失败:由于用户错误,群集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
当然,如果没有这些参数,群集将不会添加到虚拟网络中。 虚拟网络确实存在,如果我在门户中手动添加群集,我可以将其添加到相应的虚拟网络。
非常感谢您的帮助。
亲切的问候
答案 0 :(得分:0)
使用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/