أنشئ مجموعات مستندة إلى Linux في HDInsight باستخدام Azure PowerShell

تعد Azure PowerShell بيئة برمجة نصية قوية يمكنك استخدامها للتحكم في نشر وإدارة أحمال العمل الخاصة بك وإدارتها تلقائيًّا في Microsoft Azure. يوفر هذا المستند معلومات حول كيفية إنشاء مجموعة HDInsight قائمة على Linux باستخدام Azure PowerShell. يتضمّن أيضاً مثالاً على البرنامج النصي.

إذا لم يكن لديك اشتراك Azure، فأنشئ حساباً مجانياً قبل أن تبدأ.

المتطلبات الأساسية

ملاحظة

نوصي باستخدام وحدة Azure Az PowerShell للتفاعل مع Azure. راجع تثبيت Azure PowerShell للبدء. لمعرفة كيفية الترحيل إلى الوحدة النمطية Az PowerShell، راجع ترحيل Azure PowerShell من AzureRM إلى Az.

Azure PowerShell الوحدة النمطية Az.

إنشاء نظام المجموعة

تحذير

يتم تحديد فوترة مجموعات HDInsight في الدقيقة، سواء كنت تستخدمها أم لا. تأكد من حذف نظام المجموعة بعد انتهائك من استخدامه. تعرف على كيفية حذف مجموعة HDInsight.

لإنشاء كتلة HDInsight باستخدام Azure PowerShell، يجب عليك إكمال الإجراءات التالية:

  • إنشاء مجموعة موارد Azure
  • أنشئ حساب Azure Storage
  • إنشاء حاوية Azure Blob
  • إنشاء مجموعة HDInsight

ملاحظة

استخدام PowerShell لإنشاء مجموعة HDInsight مع Azure Data Lake Storage Gen2 غير مدعوم حالياً.

يوضح البرنامج النصي التالي كيفية إنشاء كتلة جديدة:

# Login to your Azure subscription
$context = Get-AzContext
if ($context -eq $null) 
{
    Connect-AzAccount
}
$context

# If you have multiple subscriptions, set the one to use
# $subscriptionID = "<subscription ID to use>"
# Select-AzSubscription -SubscriptionId $subscriptionID

# Get user input/default values
$resourceGroupName = Read-Host -Prompt "Enter the resource group name"
$location = Read-Host -Prompt "Enter the Azure region to create resources in"

# Create the resource group
New-AzResourceGroup -Name $resourceGroupName -Location $location

$defaultStorageAccountName = Read-Host -Prompt "Enter the name of the storage account"

# Create an Az.Storage account and container
New-AzStorageAccount `
    -ResourceGroupName $resourceGroupName `
    -Name $defaultStorageAccountName `
    -Type Standard_LRS `
    -Location $location
$defaultStorageAccountKey = (Get-AzStorageAccountKey `
                                -ResourceGroupName $resourceGroupName `
                                -Name $defaultStorageAccountName)[0].Value

$storageAccountResourceId = (Get-AzStorageAccount -ResourceGroupName $resourceGroupName -AccountName $defaultStorageAccountName).Id  

$defaultStorageContext = New-AzStorageContext `
                                -StorageAccountName $defaultStorageAccountName `
                                -StorageAccountKey $defaultStorageAccountKey

# Get information for the HDInsight cluster
$clusterName = Read-Host -Prompt "Enter the name of the HDInsight cluster"
# Cluster login is used to secure HTTPS services hosted on the cluster
$httpCredential = Get-Credential -Message "Enter Cluster login credentials" -UserName "admin"
# SSH user is used to remotely connect to the cluster using SSH clients
$sshCredentials = Get-Credential -Message "Enter SSH user credentials" -UserName "sshuser"

# Default cluster size (# of worker nodes), version, type, and OS
$clusterSizeInNodes = "4"
$clusterVersion = "5.1"
$clusterType = "Hadoop"
$clusterOS = "Linux"
# Set the storage container name to the cluster name
$defaultBlobContainerName = $clusterName

# Create a blob container. This holds the default data store for the cluster.
New-AzStorageContainer `
    -Name $clusterName -Context $defaultStorageContext 

# Create the HDInsight cluster
    New-AzHDInsightCluster `
    -ResourceGroupName $resourceGroupName `
    -ClusterName $clusterName `
    -Location $location `
    -ClusterSizeInNodes $clusterSizeInNodes `
    -ClusterType $clusterType `
    -OSType $clusterOS `
    -Version $clusterVersion `
    -HttpCredential $httpCredential `
    -StorageAccountResourceId $storageAccountResourceId `
    -StorageAccountKey $defaultStorageAccountKey `
    -StorageContainer $defaultBlobContainerName `
    -SshCredential $sshCredentials

يتم استخدام القيم التي تحددها لتسجيل الدخول إلى نظام المجموعة لإنشاء حساب مستخدم Hadoop للمجموعة. استخدم هذا الحساب للاتصال بالخدمات المستضافة على المجموعة مثل واجهات مستخدم الويب أو واجهات برمجة تطبيقات REST.

تُستخدم القيم التي تحددها لمستخدم SSH لإنشاء مستخدم SSH للمجموعة. استخدم هذا الحساب لبدء جلسة SSH عن بعد على الكتلة وتشغيل المهامّ. لمزيد من المعلومات، راجع مستند استخدام SSH مع HDInsight.

هام

إذا كنت تخطط لاستخدام أكثر من 32 عقدة عاملة (إما عند إنشاء الكتلة أو عن طريق قياس الكتلة بعد الإنشاء)، فيجب عليك أيضاً تحديد حجم عقدة رئيسية مع ما لا يقل عن 8 مراكز و14 جيجابايت من ذاكرة الوصول العشوائي.

لمزيد من المعلومات حول أحجام العقد والتكاليف المرتبطة بها، راجع تسعير HDInsight.

قد يستغرق إنشاء نظام المجموعة ما يصل إلى 20 دقيقة.

إنشاء نظام المجموعة: تكوين العنصر

يمكنك أيضاً إنشاء عنصر تكوين HDInsight باستخدام New-AzHDInsightClusterConfig cmdlet. يمكنك بعد ذلك تعديل عنصر التكوين هذا لتمكين خيارات التكوين الإضافية للمجموعة الخاصة بك. أخيراً، استخدم المعلمة -Config الخاصة بأمر cmdlet New-AzHDInsightCluster لاستخدام التكوين.

تخصيص المجموعات

قم بحذف نظام المجموعة

تحذير

يتم تحديد فوترة مجموعات HDInsight في الدقيقة، سواء كنت تستخدمها أم لا. تأكد من حذف نظام المجموعة بعد انتهائك من استخدامه. تعرف على كيفية حذف مجموعة HDInsight.

استكشاف الأخطاء وإصلاحها

إذا واجهت مشكلات في إنشاء مجموعات HDInsight، فراجع متطلبات التحكم في الوصول.

الخطوات التالية

الآن بعد أن أنشأت مجموعة HDInsight بنجاح، استخدم الموارد التالية لمعرفة كيفية العمل مع المجموعة الخاصة بك.

مجموعات Apache Hadoop

مجموعات Apache HBase

مجموعات أباتشي Spark