共用方式為


快速入門:使用 Azure CLI 在 AKS 叢集集區上建立 HDInsight

重要

AKS 上的 Azure HDInsight 於 2025 年 1 月 31 日淘汰。 透過此公告 深入瞭解

您必須將工作負載移轉至 Microsoft Fabric 或對等 Azure 產品,以避免突然終止工作負載。

重要

這項功能目前為預覽狀態。 Microsoft Azure 預覽版的補充使用規定 包含適用於 Beta 版、預覽版或尚未正式發行之 Azure 功能的更合法條款。 如需此特定預覽的相關資訊,請參閱 在 AKS 上的 Azure HDInsight 預覽資訊。 若有問題或功能建議,請在 AskHDInsight 上提交一個請求,並追蹤我們以獲取 Azure HDInsight 社群 上的更新。

AKS 上的 HDInsight 引進叢集集區和叢集的概念,可讓您實現 Data Lakehouse 的完整價值。

  • 叢集集區 是叢集的邏輯群組,並維護相同集區中的一組叢集,有助於跨多個叢集類型建立健全的互作性。 它可以在現有的虛擬網路或虛擬網路外部建立。

    HDInsight 在 AKS 上的叢集集區對應到 AKS 基礎結構中的一個叢集。

  • 叢集 是個別的計算工作負載,例如 Apache Spark、Apache Flink 或 Trino,可在相同的叢集集區中建立。

針對每個叢集類型,您必須有叢集集區。 它可以獨立建立,也可以在叢集建立期間建立新的叢集集區。 在本快速入門中,您將瞭解如何使用 Azure CLI 建立叢集集區。

先決條件

建立叢集集區之前,請確定您已完成 訂用帳戶必要條件

啟動 Azure Cloud Shell

Azure Cloud Shell 是一個互動式命令殼層,您可以用來執行本文中的步驟或程序。 其已預安裝並設定為與您的帳戶搭配使用的一般 Azure 工具。

    • Azure Cloud Shell中使用 Bash 環境。 如需詳細資訊,請參閱 Azure Cloud Shell 中的 Bash 快速入門

    • 如果您想要在本機執行 CLI 參考命令,安裝 Azure CLI。 如果您正在 Windows 或 macOS 上執行,請考慮在 Docker 容器中執行 Azure CLI。 如需詳細資訊,請參閱 如何在 Docker 容器中執行 Azure CLI

      • 如果您使用本機安裝,請使用 az login 命令來登入 Azure CLI。 若要完成驗證程式,請遵循終端機中顯示的步驟。 如需其他登入選項,請參閱 使用 Azure CLI 登入

      • 出現提示時,請先安裝 Azure CLI 擴充功能。 如需擴充功能的詳細資訊,請參閱 搭配 Azure CLI 使用擴充功能

      • 執行 az version,以尋找已安裝的版本和相依連結庫。 若要升級至最新版本,請執行 az upgrade

  • 本文需要 Azure CLI 2.56.0 版或更高版本。 如果您使用 Azure Cloud Shell,則已安裝該處的最新版本。

  • 如果您有多個 Azure 訂用帳戶,請選取適當的訂用帳戶標識碼,其中應該使用 az account set 命令來計費資源。 如需詳細資訊,請參閱 如何管理 Azure 訂用帳戶 – Azure CLI

  • 您也可以移至 https://shell.azure.com/bash,在個別的瀏覽器索引標籤中開啟 Cloud Shell。

定義環境變數

第一個步驟是定義環境變數。 環境變數通常用於 Linux,以集中設定數據,以改善系統的一致性和可維護性。 建立下列環境變數,以指定您稍後在本教學課程中建立的資源名稱:

export ResourceGroup="HDIonAKSCLI"
export Region=EastUS
export HDIonAKSClusterPoolName="contosopool"
export NodeType="Standard_E4s_v3"
export ClusterVersion="1.1"

使用 CLI 登入 Azure

若要使用 CLI 在 Azure 中執行命令,您必須先登入。 使用 az login 命令登入。

建立資源群組

資源群組是相關資源的容器。 所有資源都必須放在資源群組中。 az group create 命令 會使用先前定義的 $ResourceGroup$Region 參數來建立資源群組。

az group create --name $ResourceGroup --location $Region

輸出:

{
  "id": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/HDIonAKSCLI",
  "location": "eastus",
  "managedBy": null,
  "name": "HDIonAKSCLI",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": null,
  "type": "Microsoft.Resources/resourceGroups"
}

在 AKS 叢集集區上建立 HDInsight

若要在此資源群組的 AKS 叢集集區上建立 HDInsight,請使用 az hdinsight-on-aks clusterpool create 命令:

az hdinsight-on-aks clusterpool create --cluster-pool-name
                                       --resource-group
                                       [--api-server-authorized-ip-ranges]
                                       [--cluster-pool-version]
                                       [--enable-log-analytics {0, 1, f, false, n, no, t, true, y, yes}]
                                       [--la-workspace-id]
                                       [--location]
                                       [--managed-rg-name]
                                       [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                                       [--outbound-type {loadBalancer, userDefinedRouting}]
                                       [--private-server-enabled {0, 1, f, false, n, no, t, true, y, yes}]
                                       [--subnet-id]
                                       [--tags]
                                       [--workernode-size]

以下是範例:

az hdinsight-on-aks clusterpool create --resource-group $ResourceGroup --cluster-pool-name $HDIonAKSClusterPoolName --location $Region --workernode-size $NodeType --cluster-pool-version $ClusterVersion

在 AKS 叢集集區上建立 HDInsight 需要幾分鐘的時間。 下列範例輸出顯示已建立的作業成功。

輸出:

{
  "aksClusterProfile": {
    "aksClusterAgentPoolIdentityProfile": {
      "msiClientId": "00000000-0000-0000-0000-XXXXXXXX1",
      "msiObjectId": "00000000-0000-0000-0000-XXXXXXX11",
      "msiResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/MC_hdi-00000000000000000000XXXX_contosopool_eastus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contosopool-agentpool"
    },
    "aksClusterResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/hdi-00000000000000000000XXXX/providers/Microsoft.ContainerService/managedClusters/contosopool",
    "aksVersion": "1.27.9"
  },
  "aksManagedResourceGroupName": "MC_hdi-00000000000000000000XXXX_contosopool_eastus",
  "clusterPoolProfile": {
    "clusterPoolVersion": "1.1"
  },
  "computeProfile": {
    "count": 3,
    "vmSize": "Standard_E4s_v3"
  },
  "deploymentId": "00000000000000000000XXXX",
  "id": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/HDIonAKSCLI/providers/Microsoft.HDInsight/clusterpools/contosopool",
  "location": "EastUS",
  "managedResourceGroupName": "hdi-00000000000000000000XXXX",
  "name": "contosopool",
  "provisioningState": "Succeeded",
  "resourceGroup": "HDIonAKSCLI",
  "status": "Running",
  "systemData": {
    "createdAt": "2024-05-31T15:02:42.2172295Z",
    "createdBy": "john@contoso.com",
    "createdByType": "User",
    "lastModifiedAt": "2024-05-31T15:02:42.2172295Z",
    "lastModifiedBy": "john@contoso.com",
    "lastModifiedByType": "User"
  },
  "type": "microsoft.hdinsight/clusterpools"
}

注意

如需叢集集區 CLI 命令的詳細資訊,請參閱 命令。

清除資源

不再需要時,請清除不必要的資源,以避免 Azure 費用。 您可以使用 az group delete 命令,移除資源群組中的資源群組、叢集集區和所有其他資源。

注意

若要刪除叢集集區,請確定叢集集區中沒有作用中的叢集。