Создайте HDCluster с помощью powershell

Я пытаюсь создать кластер с помощью powershell. Вот скрипт, который я выполняю:

$containerName = "hdfiles"
$location = "Southeast Asia"
$clusterNodes = 2
$userName = "HDUser"

#Generate random password
$rand = New-Object System.Random
$pass = ""
$pass = $pass + [char]$rand.next(97,121) #lower case
$pass = $pass + [char]$rand.next(48,57) #number
$pass = $pass + [char]$rand.next(65,90) #upper case
$pass = $pass + [char]$rand.next(58,62) #special character
1..6 | ForEach { $pass = $pass + [char]$rand.next(97,121) } #6 lower-case characters
$password = ConvertTo-SecureString $pass -AsPlainText -Force

# generate unique random cluster and storage account names
do
{
  $clusterName = "hd"
  1..6 | ForEach { $clusterName = $clusterName + [char]$rand.next(48,57) }
  $storageAccountName = $clusterName + "store"
}
while ((Test-AzureName -Name $storageAccountName -Storage) -and (Test-AzureName -Name $clusterName -Service))

# Create a storage account
Write-Host "Creating storage account..."
New-AzureStorageAccount -StorageAccountName $storageAccountName -Location $location

# Create a Blob storage container
Write-Host "Creating container..."
$storageAccountKey = Get-AzureStorageKey $storageAccountName | %{ $_.Primary }
$destContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
New-AzureStorageContainer -Name $containerName -Context $destContext

# Create a cluster
Write-Host "Creating HDInsight cluster..."
$credential = New-Object System.Management.Automation.PSCredential ($userName, $password)
New-AzureHDInsightCluster -Name $clusterName -Location $location -DefaultStorageAccountName "$storageAccountName.blob.core.windows.net" -DefaultStorageAccountKey $storageAccountKey -DefaultStorageContainerName $containerName -ClusterSizeInNodes $clusterNodes -Credential $credential -Version 3.2

Но в последней строке я получаю исключение:

New-AzureHDInsightCluster : Validating connection to 'hd662173store.blob.core.windows.net' failed. Inner exception:Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At D:\ProgrammingWorkspace\Edx\Processing BigData with HDInsight\HDILabs\Lab02A\Provision HDInsight.ps1:38 char:1 + New-AzureHDInsightCluster -Name $clusterName -Location $location -Def ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [New-AzureHDInsightCluster], ConfigurationErrorsException
+ FullyQualifiedErrorId : System.Configuration.ConfigurationErrorsException,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.NewAzureHDInsightClusterCmdlet

Я использую Azure Powershell версии 0.9.7 и Azure SDK 2.7.


person Uriil    schedule 22.08.2015    source источник
comment
Изменить, чтобы добавить: Мои извинения! Оказалось, что ключевое слово, которое я искал, было в разделе «Связанные». Пробовали ли вы переустановить Azure SDK и перезагрузить компьютер? И проверьте здесь stackoverflow.com/questions/22841556/   -  person user4317867    schedule 22.08.2015
comment
Да, несколько раз. На самом деле в папке SDK у меня есть эта библиотека, но версия 5.0.0   -  person Uriil    schedule 22.08.2015


Ответы (1)


Оглядываясь назад, можно сказать, что проблема, с которой вы столкнулись, теперь, скорее всего, устранена в последней версии Azure PowerShell.

Чтобы установить последнюю версию Azure PowerShell, см. здесь: Установка Azure PowerShell

Примеры использования командлетов HDInsight PowerShell (например, New-AzureRmHDInsightCluster) см. здесь: Использование командлетов HDInsight Azure PowerShell

Надеюсь, это поможет!

person Matt H    schedule 18.02.2016