Share via


Azure HDInsight 中的叢集 REST API

建立

在指定的訂用帳戶中建立叢集。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
PUT https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}?api-version={api-version}

下列範例顯示建立以Linux為基礎的Hadoop叢集的要求本文。 如需以其他方式建立叢集的範例,請參閱下方的一節。

{  
    "id":"/subscriptions/{subscription-id}/resourceGroups/myresourcegroup1/providers/Microsoft.HDInsight/clusters/mycluster",  
  "name":"mycluster",   
  "type":"Microsoft.HDInsight/clusters",  
  
    "location": "location-name",  
    "tags": { "tag1": "value1", "tag2": "value2" },  
    "properties": {  
        "clusterVersion": "3.2",  
        "osType": "Linux",  
        "clusterDefinition": {  
            "kind": "hadoop",  
  
            "configurations": {  
                "gateway": {  
                    "restAuthCredential.isEnabled": true,  
                    "restAuthCredential.username": "http-user",  
                    "restAuthCredential.password": "password"  
                },  
  
                "core-site": {  
                    "fs.defaultFS": "wasb://container@storageaccount.blob.core.windows.net",  
                    "fs.azure.account.key.storageaccount.blob.core.windows.net": storage-account-key"  
                }  
            }  
        },
  
        "computeProfile": {  
            "roles": [  
                {  
                    "name": "headnode",  
  
                    "targetInstanceCount": 2,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    },  
  
                    "osProfile": {  
                        "linuxOperatingSystemProfile": {  
                            "username": "username",  
                            "sshProfile": {  
                                "publicKeys": [   
                                    { "certificateData": "ssh-rsa key" }  
                                ]  
                            }  
                        }  
                    }  
                },  
                {  
                    "name": "workernode",  
  
                    "targetInstanceCount": 1,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    },  
  
                    "osProfile": {  
                        "linuxOperatingSystemProfile": {  
                            "username": "username",  
                            "sshProfile": {  
                                "publicKeys": [  
                                    { "certificateData": " ssh-rsa key" }  
                                ]  
                            }  
                        }  
                    }  
                },  
                {  
                    "name": "zookeepernode",  
  
                    "targetInstanceCount": 3,  
  
                    "hardwareProfile": {  
                        "vmSize": "Small"  
                    },  
  
                    "osProfile": {  
                        "linuxOperatingSystemProfile": {  
                            "username": "username",  
                            "sshProfile": {  
                                "publicKeys": [   
                                    { "certificateData": "ssh-rsa key" }  
                                ]  
                            }  
                        }  
                    }  
                }  
            ]  
        }  
    }  
}  
  
元素名稱 必要 類型 Description
id Yes 字串 指定叢集的資源識別碼。
NAME 字串 指定叢集的名稱。
類型 字串 指定叢集的類型。
location 字串 指定應該在其中建立叢集的支援 Azure 位置。 如需詳細資訊,請參閱 列出所有可用的地理位置
tags String 指定將指派給叢集的標記。 如需使用標籤的詳細資訊,請參閱 使用標籤來組織 Azure 資源
屬性 Yes 複雜類型 指定叢集的屬性。

屬性

元素名稱 必要 類型 Description
clusterVersion 字串 指定叢集版本
osType 字串 指定叢集的作業系統。

有效值為 LinuxWindows
clusterDefinition Yes 複雜類型 指定叢集類型和組態的相關信息
computeProfile Yes 複雜類型 指定叢集拓撲和相關角色屬性的相關信息

clusterDefinition

元素名稱 必要 類型 Description
kind 字串 指定叢集類型。

有效值為hadoop、hbase、storm & spark
組態 Yes 字典 這個專案是組態類型的字典及其相關聯的值字典。

閘道組態類型可用來設定用來連線至 Web API 和 Ambari 入口網站的 HTTP 使用者

核心站台組態類型是用來設定叢集的預設記憶體帳戶

computeProfile

元素名稱 必要 類型 Description
clusterVersion 字串 指定叢集版本
role Yes 複雜類型 (角色) 陣列 指定叢集中角色的相關信息

角色 (role)

元素名稱 必要 類型 Description
NAME 字串 指定角色名稱
targetInstanceCount 整數 指定角色的目標實例計數
hardwareProfile Yes 複雜類型 指定角色硬體配置檔的相關信息
osProfile Yes 複雜類型 指定角色 OS 設定檔的相關信息

hardwareProfile

元素名稱 必要 類型 Description
vmSize 字串 指定 VM 的大小。 請參閱此連結上的 HDInsight 設定選項 (一次,請向下卷動至 節點定價層) 以取得有效大小

osProfile

元素名稱 必要 類型 Description
linuxOperatingSystemProfile No 複雜類型 指定 Linux OS 相關設定
windowsOperatingSystemProfile No 複雜類型 指定 Windows OS 相關設定
virtualNetworkProfile No 複雜類型 如果叢集部署在使用者訂用帳戶中的虛擬網路中,則指定虛擬網路相關設定
scriptActions No 複雜類型的陣列 在叢集上執行的腳本動作清單

linuxOperatingSystemProfile

元素名稱 必要 類型 Description
使用者名稱 字串 SSH 使用者名稱
sshProfile No 複雜類型 指定 SSH 金鑰。

需要其中一個 sshProfile 或 Password。
密碼 String 指定 SSH 密碼

需要其中一個 sshProfile 或 Password。

sshProfile

元素名稱 必要 類型 Description
publicKeys Array 包含 certificateData 物件的清單。 值為 ssh-rsa 公鑰

windowsOperatingSystemProfile

元素名稱 必要 類型 Description
rdpSettings No 複雜類型 指定 Windows 叢集的 RDP 設定

rdpSettings

元素名稱 必要 類型 描述
username 字串 指定 RDP 用戶名稱
密碼 字串 指定 RDP 用戶的密碼
expiryDate Date RDP 認證的到期日

virtualNetworkProfile

元素名稱 必要 類型 Description
id Yes 字串 虛擬網路 資源標識碼
子網路 字串 指定子網名稱

scriptActions

元素名稱 必要 類型 Description
NAME 字串 文稿動作的易記名稱
uri 字串 腳本動作檔案的 URL
參數 String 執行腳本動作檔時要傳遞的自變數

回應

如果驗證完成且接受要求,作業會傳回 200 (OK) 。

狀態代碼: 200 確定

Linux 叢集的回應本文會使用 ssh 金鑰建立:

{  
    "id":"/subscriptions/{subscription-id}/resourceGroups/myresourcegroup1/providers/Microsoft.HDInsight/clusters/mycluster",  
  "name":"mycluster",   
  "type":"Microsoft.HDInsight/clusters",  
  
    "location": "location-name",  
    "tags": { "tag1": "value1", "tag2": "value2" },  
    "properties": {  
        "clusterVersion": "3.2",  
        "osType": "Linux",  
		"provisioningState": "InProgress",  
		"clusterState": "Accepted",  
		"createdDate": "2015-09-23",  
		"quotaInfo": {  
			"coresUsed": 20  
}  
        "clusterDefinition": {  
            "kind": "hadoop"  
        },  
  
        "computeProfile": {  
            "roles": [  
                {  
                    "name": "headnode",  
  
                    "targetInstanceCount": 2,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    }  
  
                },  
                {  
                    "name": "workernode",  
  
                    "targetInstanceCount": 1,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    }  
                },  
                {  
                    "name": "zookeepernode",  
  
                    "targetInstanceCount": 3,  
  
                    "hardwareProfile": {  
                        "vmSize": "Small"  
                    }  
                }  
            ]  
        }  
    }  
}  
  
元素名稱 類型 Description
provisioningState 字串 指出目前的布建狀態。
clusterState 字串 指出布建進行時更詳細的 HDInsight 叢集狀態。
createdDate Date 收到叢集建立要求的日期時間
quotaInfo 複雜類型 指定叢集所使用的核心
錯誤 錯誤訊息的陣列 如果 provisioningState = 'failed“ ,則包含錯誤訊息
connectivityEndpoints 複雜類型 指定叢集的公用端點

connectivityEndpoints

元素名稱 類型 Description
NAME String 線上端點的易記名稱
protocol String 指定要使用 (範例的通訊協定:HTTPS、SSH)
location 字串 指定要連接的 URL
連接埠 int 指定要連接的埠

建立僅限 Linux 的進階、已加入網域的 HDInsight 叢 (集、預覽)

使用 Apache Ranger 建立已加入網域的進階叢集。 用戶必須在要求本文中提供 SecurityProfile,才能建立安全的叢集。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
PUT https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}?api-version={api-version}

下列範例顯示建立Linux型、進階、已加入網域的Hadoop叢集的要求本文。

{
	"id": "/subscriptions/{ subscription-id }/resourceGroups/myresourcegroup1/providers/Microsoft.HDInsight/ clusters/mycluster ", "
	name "
	: "mycluster",
	"type": "Microsoft.HDInsight/clusters",
	"location": "location-name",
	"tags": {
		"tag1": "value1",
		"tag2": "value2"
	},
	"properties": {
		"clusterVersion": "3.5",
		"osType": "Linux",
		"tier": "premium",
		"clusterDefinition": {
			"kind": "hadoop",
			"configurations": {
				"gateway": {
					"restAuthCredential.isEnabled": true,
					"restAuthCredential.username": "http-user",
					"restAuthCredential.password": "password"
				},
				"core-site": {
					"fs.defaultFS": "wasb://container@storageaccount.blob.core.windows.net",
					"fs.azure.account.key.storageaccount.blob.core.windows.net": "storage-account-key"
				}
			}
		},
		"securityProfile": {
			"directoryType": "ActiveDirectory",
			"domain": "mydomain.com",
			"organizationalUnitDN": "OU=Hadoop,DC=mydomain,DC=COM",
			"ldapsUrls": ["ldaps://mydomain.com:636"],
			"domainUsername": "clusteradmin@mydomain.com",
			"domainUserPassword": "password",
			"clusterUsersGroupDNs": ["ADGroup1", "ADGroup2"]
		},
		"computeProfile": {
			"roles": [
				{
					"name": "headnode",
					"targetInstanceCount": 2,
					"hardwareProfile": {
						"vmSize": "Large"
					},
					"osProfile": {
						"linuxOperatingSystemProfile": {
							"username": "username",
							"sshProfile": {
								"publicKeys": [
									{
										"certificateData": "ssh-rsa key"
									}
								]
							}
						}
					},
					"virtualNetworkProfile": {
						"id": "/subscriptions/mysubscriptionid/resourceGroups/myrresourcegroup/providers/Microsoft.Network/virtualNetworks/myvirtualnetwork",
						"subnet": "/subscriptions/mysubscriptionid /resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/myvirtualnetwork/subnets/mysubnet"
					}
				},
				{
					"name": "workernode",
					"targetInstanceCount": 1,
					"hardwareProfile": {
						"vmSize": "Large"
					},
					"osProfile": {
						"linuxOperatingSystemProfile": {
							"username": "username",
							"sshProfile": {
								"publicKeys": [
									{
										"certificateData": " ssh-rsa key"
									}
								]
							}
						}
					},
					"virtualNetworkProfile": {
						"id": "/subscriptions/mysubscriptionid/resourceGroups/myrresourcegroup/providers/Microsoft.Network/virtualNetworks/myvirtualnetwork",
						"subnet": "/subscriptions/mysubscriptionid /resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/myvirtualnetwork/subnets/mysubnet"
					}
				},
				{
					"name": "zookeepernode",
					"targetInstanceCount": 3,
					"hardwareProfile": {
						"vmSize": "Small"
					},
					"osProfile": {
						"linuxOperatingSystemProfile": {
							"username": "username",
							"sshProfile": {
								"publicKeys": [
									{
										"certificateData": "ssh-rsa key"
									}
								]
							}
						},
						"virtualNetworkProfile": {
							"id": "/subscriptions/mysubscriptionid/resourceGroups/myrresourcegroup/providers/Microsoft.Network/virtualNetworks/myvirtualnetwork",
							"subnet": "/subscriptions/mysubscriptionid /resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/myvirtualnetwork/subnets/mysubnet"
						}
					}
				}
			]
		}
	}
}  
  
元素名稱 必要 類型 Description
id Yes 字串 指定叢集的資源識別碼。
NAME 字串 指定叢集的名稱。
類型 字串 指定叢集的類型。
location 字串 指定應該在其中建立叢集的支援 Azure 位置。 如需詳細資訊,請參閱 列出所有可用的地理位置
tags String 指定將指派給叢集的標記。 如需使用標籤的詳細資訊,請參閱 使用標籤來組織您的 Azure 資源
屬性 Yes 複雜類型 指定叢集的屬性。

屬性

元素名稱 必要 類型 Description
clusterVersion 字串 指定叢集版本
osType 字串 指定叢集的作業系統。

有效值為Linux,因為只有 Linux 叢集類型可以加入 Azure AD 網域。
tier String 預設值為 標準。 有效值為標準和進階。 如果未指定任何值,則會假設該值為 標準值。 指定叢集的階層。 只有進階層才支援已加入網域的叢集
clusterDefinition Yes 複雜類型 指定叢集類型和組態的相關信息
computeProfile Yes 複雜類型 指定叢集拓撲和相關聯角色屬性的相關信息
securityProfile No 複雜類型 如果正在建立已加入網域的安全叢集,此元素會指定 Active Directory 相關設定

clusterDefinition

元素名稱 必要 類型 Description
kind 字串 指定叢集類型。

有效值為hadoop、hbase、storm & spark
組態 Yes 字典 這個專案是組態類型的字典及其相關聯的值字典。

閘道組態類型可用來設定用來連線到 Web API 和 Ambari 入口網站的 HTTP 使用者

核心站台組態類型可用來設定叢集的預設記憶體帳戶

computeProfile

元素名稱 必要 類型 Description
clusterVersion 字串 指定叢集版本
role Yes 複雜類型 (角色) 陣列 指定叢集中角色的相關信息

securityProfile

元素名稱 必要 類型 Description
directoryType 字串 使用的LDAP目錄類型。 目前 「ActiveDirectory」 是唯一支援的值。
網域 字串 叢集的 Active Directory 網域
organizationUnitDN 字串 Active Directory 中將建立使用者和計算機帳戶的組織單位辨別名稱
ldapsUrls Yes 字串陣列 Active Directory 的一或多部 LDAPS 伺服器的 URL
domainUserName 字串 具有足夠許可權的網域用戶帳戶,可建立叢集。 其格式應為 user@domain
domainUserPassword 字串 網域用戶帳戶的密碼
clusterUsersGroupDNS No 字串陣列 Ambari 和 Apache Ranger 中可用的 Active Directory 群組辨別名稱

角色 (role)

元素名稱 必要 類型 Description
NAME 字串 指定角色名稱
targetInstanceCount 整數 指定角色的目標實例計數
hardwareProfile Yes 複雜類型 指定角色硬體配置檔的相關信息
osProfile Yes 複雜類型 指定角色作業系統配置檔的相關信息

hardwareProfile

元素名稱 必要 類型 Description
vmSize 字串 指定 VM 的大小。 請參閱此連結上的 HDInsight 組態選項 (一次,向下捲動至 節點定價層) 以取得有效大小

osProfile

元素名稱 必要 類型 Description
linuxOperatingSystemProfile No 複雜類型 指定 Linux OS 相關設定
virtualNetworkProfile No 複雜類型 指定虛擬網路相關設定,如果叢集部署在用戶的訂用帳戶中的虛擬網路中
scriptActions No 複雜類型的陣列 在叢集上執行的腳本動作清單

linuxOperatingSystemProfile

元素名稱 必要 類型 Description
使用者名稱 字串 SSH 使用者名稱
sshProfile No 複雜類型 指定 SSH 金鑰。

需要其中一個 sshProfile 或 Password。
密碼 String 指定 SSH 密碼

需要其中一個 sshProfile 或 Password。

sshProfile

元素名稱 必要 類型 Description
publicKeys Array 包含 certificateData 物件的清單。 值為 ssh-rsa 公鑰

virtualNetworkProfile

元素名稱 必要 類型 Description
id Yes 字串 虛擬網路 資源標識碼
子網路 字串 指定子網名稱

scriptActions

元素名稱 必要 類型 Description
NAME 字串 文稿動作的易記名稱
uri 字串 腳本動作檔案的 URL
參數 String 執行腳本動作檔時要傳遞的自變數

回應

如果驗證完成且接受要求,作業會傳回 200 (OK) 。

狀態代碼: 200 確定

Linux 叢集的回應本文會使用 ssh 金鑰建立:

{  
    "id":"/subscriptions/{subscription-id}/resourceGroups/myresourcegroup1/providers/Microsoft.HDInsight/clusters/mycluster",  
  "name":"mycluster",   
  "type":"Microsoft.HDInsight/clusters",  
  
    "location": "location-name",  
    "tags": { "tag1": "value1", "tag2": "value2" },  
    "properties": {  
        "clusterVersion": "3.2",  
        "osType": "Linux",  
		"provisioningState": "InProgress",  
		"clusterState": "Accepted",  
		"createdDate": "2015-09-23",  
		"quotaInfo": {  
			"coresUsed": 20  
}  
        "clusterDefinition": {  
            "kind": "hadoop"  
        },  
  
        "computeProfile": {  
            "roles": [  
                {  
                    "name": "headnode",  
  
                    "targetInstanceCount": 2,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    }  
  
                },  
                {  
                    "name": "workernode",  
  
                    "targetInstanceCount": 1,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    }  
                },  
                {  
                    "name": "zookeepernode",  
  
                    "targetInstanceCount": 3,  
  
                    "hardwareProfile": {  
                        "vmSize": "Small"  
                    }  
                }  
            ]  
        }  
    }  
}  
  
元素名稱 類型 Description
provisioningState 字串 指出目前的布建狀態。
clusterState 字串 指出布建進行時更詳細的 HDInsight 叢集狀態。
createdDate Date 收到叢集建立要求的日期時間
quotaInfo 複雜類型 指定叢集所使用的核心
錯誤 錯誤訊息的陣列 如果 provisioningState = 'failed“ ,則包含錯誤訊息
connectivityEndpoints 複雜類型 指定叢集的公用端點

connectivityEndpoints

元素名稱 類型 Description
NAME String 線上端點的易記名稱
protocol String 指定要使用 (範例的通訊協定:HTTPS、SSH)
location 字串 指定要連接的 URL
連接埠 int 指定要連接的埠

使用 Azure Data Lake Store 作為預設文件系統來建立叢集

使用 Azure Data Lake Store 作為預設文件系統,在指定的訂用帳戶中建立叢集。 在要求本文中提供 ClusterIdentity 物件,並使用適當的 Data Lake Store URL 設定 預設檔案系統 屬性。

Azure Data Lake 可以設定為從 3.5 開始的叢集版本的預設文件系統。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
PUT https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}?api-version={api-version}}

下列範例示範使用 Azure Data Lake Store 作為叢集的預設文件系統來建立 Linux 型 Hadoop 叢集的要求本文。

{
	"id": "/subscriptions/{subscription-id}/resourceGroups/myresourcegroup1/providers/Microsoft.HDInsight/clusters/mycluster",
	"name": "mycluster",
	"type": "Microsoft.HDInsight/clusters",
	"location": "location-name",
	"tags": {
		"tag1": "value1",
		"tag2": "value2"
	},
	"properties": {
		"clusterVersion": "3.5",
		"osType": "Linux",
		"tier": "Standard",
		"clusterDefinition": {
			"kind": "hadoop",
			"configurations": {
				"gateway": {
					"restAuthCredential.isEnabled": true,
					"restAuthCredential.username": "http-user",
					"restAuthCredential.password": "password"
				},
				"clusterIdentity": {
					"clusterIdentity.applicationId": "applicationId",
					"clusterIdentity.certificate": "certificate-contents-in-base64-encoding",
					"clusterIdentity.aadTenantId": "aad-tenant-id",
					"clusterIdentity.resourceUri": "https://KonaCompute.net/",
					"clusterIdentity.certificatePassword": "certificate-password"
				},
				"core-site": {
					"fs.defaultFS": "adl://home",
					"dfs.adls.home.hostname": "yourstorageaccount.azuredatalakestore.net",
					"dfs.adls.home.mountpoint": "/path/to/cluster/root"
				}
			}
		},
		"computeProfile": {
			"roles": [
				{
					"name": "headnode",
					"targetInstanceCount": 2,
					"hardwareProfile": {
						"vmSize": "Large"
					},
					"osProfile": {
						"linuxOperatingSystemProfile": {
							"username": "username",
							"sshProfile": {
								"publicKeys": [
									{
										"certificateData": "ssh-rsa key"
									}
								]
							}
						}
					}
				},
				{
					"name": "workernode",
					"targetInstanceCount": 1,
					"hardwareProfile": {
						"vmSize": "Large"
					},
					"osProfile": {
						"linuxOperatingSystemProfile": {
							"username": "username",
							"sshProfile": {
								"publicKeys": [
									{
										"certificateData": " ssh-rsa key"
									}
								]
							}
						}
					}
				},
				{
					"name": "zookeepernode",
					"targetInstanceCount": 3,
					"hardwareProfile": {
						"vmSize": "Small"
					},
					"osProfile": {
						"linuxOperatingSystemProfile": {
							"username": "username",
							"sshProfile": {
								"publicKeys": [
									{
										"certificateData": "ssh-rsa key"
									}
								]
							}
						}
					}
				}
			]
		}
	}
}  

元素名稱 必要 類型 Description
id Yes 字串 指定叢集的資源識別碼。
NAME 字串 指定叢集的名稱。
類型 字串 指定叢集的類型。
location 字串 指定應該在其中建立叢集的支援 Azure 位置。 如需詳細資訊,請參閱 列出所有可用的地理位置
tags String 指定將指派給叢集的標記。 如需使用標籤的詳細資訊,請參閱 使用標籤來組織 Azure 資源
屬性 Yes 複雜類型 指定叢集的屬性。

屬性

元素名稱 必要 類型 Description
clusterVersion 字串 指定叢集版本
osType 字串 指定叢集的作業系統。

有效值為 Linux
tier String 指定叢集的層。 有效值為 標準進階。 如果未指定階層,叢集將會是標準層。
clusterDefinition Yes 複雜類型 指定叢集類型和組態的相關信息
computeProfile Yes 複雜類型 指定叢集拓撲和相關角色屬性的相關信息

clusterDefinition

元素名稱 必要 類型 Description
kind 字串 指定叢集類型。

有效值為hadoop、hbase、storm & spark
組態 Yes 字典 這個專案是組態類型的字典及其相關聯的值字典。

閘道組態類型可用來設定用來連線至 Web API 和 Ambari 入口網站的 HTTP 使用者

核心站台組態類型是用來設定叢集的預設記憶體帳戶

computeProfile

元素名稱 必要 類型 Description
clusterVersion 字串 指定叢集版本
role Yes 複雜類型 (角色) 陣列 指定叢集中角色的相關信息

角色 (role)

元素名稱 必要 類型 Description
NAME 字串 指定角色名稱
targetInstanceCount 整數 指定角色的目標實例計數
hardwareProfile Yes 複雜類型 指定角色硬體配置檔的相關信息
osProfile Yes 複雜類型 指定角色作業系統配置檔的相關信息

hardwareProfile

元素名稱 必要 類型 Description
vmSize 字串 指定 VM 的大小。 請參閱此連結上的 HDInsight 組態選項 (一次,向下捲動至 節點定價層) 以取得有效大小

osProfile

元素名稱 必要 類型 Description
linuxOperatingSystemProfile No 複雜類型 指定 Linux OS 相關設定
virtualNetworkProfile No 複雜類型 指定虛擬網路相關設定,如果叢集部署在用戶的訂用帳戶中的虛擬網路中
scriptActions No 複雜類型的陣列 在叢集上執行的腳本動作清單

linuxOperatingSystemProfile

元素名稱 必要 類型 Description
使用者名稱 字串 SSH 使用者名稱
sshProfile No 複雜類型 指定 SSH 金鑰。

需要其中一個 sshProfile 或 Password。
密碼 String 指定 SSH 密碼

需要其中一個 sshProfile 或 Password。

sshProfile

元素名稱 必要 類型 Description
publicKeys Array 包含 certificateData 物件的清單。 值為 ssh-rsa 公鑰

virtualNetworkProfile

元素名稱 必要 類型 Description
id Yes 字串 虛擬網路 資源標識碼
子網路 字串 指定子網名稱

scriptActions

元素名稱 必要 類型 Description
NAME 字串 文稿動作的易記名稱
uri 字串 腳本動作檔案的 URL
參數 String 執行腳本動作檔時要傳遞的自變數

回應

如果驗證完成且接受要求,作業會傳回 200 (OK) 。

狀態代碼: 200 確定

Linux 叢集的回應本文會使用 ssh 金鑰建立:

{
	"id": "/subscriptions/{subscription ID}/resourceGroups/rg1/providers/Microsoft.HDInsightCurrent/clusters/mycluster",
	"name": "mycluster",
	"type": "Microsoft.HDInsightCurrent/clusters",
	"location": "East Asia",
	"etag": "{value}",
	"tags": null,
	"properties": {
		"clusterVersion": "3.5.1000.0",
		"osType": "Linux",
		"clusterDefinition": {
			"kind": "hadoop"
		},
		"computeProfile": {
			"roles": [
				{
					"name": "headnode",
					"targetInstanceCount": 2,
					"hardwareProfile": {
						"vmSize": "Standard_D3"
					},
					"osProfile": {
						"linuxOperatingSystemProfile": {
							"username": "myuser"
						}
					}
				},
				{
					"name": "workernode",
					"targetInstanceCount": 2,
					"hardwareProfile": {
						"vmSize": "Standard_D3"
					},
					"osProfile": {
						"linuxOperatingSystemProfile": {
							"username": "myuser"
						}
					}
				}
			]
		},
		"provisioningState": "InProgress",
		"clusterState": "Accepted",
		"createdDate": "2016-11-15T09:21:47.61",
		"quotaInfo": {
			"coresUsed": 16
		},
		"tier": "standard"
	}
}  
元素名稱 類型 Description
provisioningState 字串 指出目前的布建狀態。
clusterState 字串 指出布建進行時更詳細的 HDInsight 叢集狀態。
createdDate Date 收到叢集建立要求的日期時間
quotaInfo 複雜類型 指定叢集所使用的核心
錯誤 錯誤訊息的陣列 如果 provisioningState = 'failed“ ,則包含錯誤訊息
connectivityEndpoints 複雜類型 指定叢集的公用端點

connectivityEndpoints

元素名稱 類型 Description
NAME String 線上端點的易記名稱
protocol String 指定要使用 (範例的通訊協定:HTTPS、SSH)
location 字串 指定要連接的 URL
連接埠 int 指定要連接的埠

刪除

刪除 HDInsight 叢集。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
DELETE https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}?api-version={api-version}

回應

HTTP 202 (已接受) 表示作業會以異步方式完成。 異步輪詢會在作業成功完成之後傳回 204 (NoContent) 。

備註

若要追蹤刪除叢集要求的進度,請參閱 異步操作 (202 已接受和位置標頭)

Get

取得指定叢集的詳細資料/屬性。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
GET https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}?api-version={api-version}

回應

如果要求順利完成,作業會傳回 200 (OK)

狀態代碼: 200 確定

回應本文與建立叢集相同。

Linux 叢集詳細數據的回應本文

{  
    "id":"/subscriptions/{subscription-id}/resourceGroups/myresourcegroup1/providers/Microsoft.HDInsight/clusters/mycluster",  
  "name":"mycluster",   
  "type":"Microsoft.HDInsight/clusters",  
  
    "location": "location-name",  
    "tags": { "tag1": "value1", "tag2": "value2" },  
    "properties": {  
        "clusterVersion": "3.2",  
        "osType": "Linux",  
		"provisioningState": "InProgress",  
		"clusterState": "Accepted",  
		"createdDate": "2015-09-23",  
		"quotaInfo": {  
			"coresUsed": 20  
}  
        "clusterDefinition": {  
            "kind": "hadoop"  
        },  
  
        "computeProfile": {  
            "roles": [  
                {  
                    "name": "headnode",  
  
                    "targetInstanceCount": 2,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    },  
                    "osProfile": {  
                       "linuxOperatingSystemProfile": {  
                          "username": "sshuser"  
                       }  
                     }  
  
                },  
                {  
                    "name": "workernode",  
  
                    "targetInstanceCount": 1,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    },  
  
                    "osProfile": {  
                       "linuxOperatingSystemProfile": {  
                          "username": "sshuser"  
                       }  
                     }  
  
                },  
                {  
                    "name": "zookeepernode",  
  
                    "targetInstanceCount": 3,  
  
                    "hardwareProfile": {  
                        "vmSize": "Small"  
                    },  
  
                    "osProfile": {  
                       "linuxOperatingSystemProfile": {  
                          "username": "sshuser"  
                       }  
                     }  
                }  
            ]  
        }  
    }  
}  
  
元素名稱 類型 Description
provisioningState 字串 表示目前的布建狀態。
clusterState 字串 指出布建正在進行時更詳細的 HDInsight 叢集狀態。
createdDate Date 收到叢集建立要求的日期時間
quotaInfo 複雜類型 指定叢集所使用的核心
錯誤 錯誤訊息的陣列 如果 provisioningState = 'failed“ 包含錯誤訊息
connectivityEndpoints 複雜類型 指定叢集的公用端點

connectivityEndpoints

元素名稱 類型 Description
NAME String 線上端點的易記名稱
protocol String 指定要使用 (範例的通訊協定:HTTPS、SSH)
location 字串 指定要連線的 URL
連接埠 int 指定要連接的埠

列出組態

擷取所有叢集組態詳細數據, (包括敏感性資訊) 。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
POST https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/configurations?api-version={api-version}

回應

HTTP 200 (OK) 成功完成作業。

範例回應:

"configurations":   
{  
     "gateway": {  
          "restAuthCredential.isEnabled": true,  
          "restAuthCredential.username": "username",  
          "restAuthCredential.password": "Password123!"     
      },  
  
      "core-site": {  
           "fs.defaultFS": "wasbs://mycontainter@mystorageaccount.blob.core.windows.net",
	   "fs.azure.account.key.mystorageaccount.blob.core.windows.net": "storagekey1value"  
      }  
}  
  
元素名稱 類型 Description
組態 字典 這個專案是組態類型的字典及其相關聯的值字典。
閘道組態類型可用來設定用來連線到 Web API 和 Ambari 入口網站的 HTTP 使用者
核心站台組態類型可用來設定叢集的預設記憶體帳戶

取得設定

取得單一組態類型的詳細數據, (省略敏感性值) 。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
GET https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/configurations/{configuration Type}?api-version={api-version}

回應

HTTP 200 (OK) 成功完成作業。

範例回應:

{
     "core-site": {  
          "fs.defaultFS": "wasbs://mycontainter@mystorageaccount.blob.core.windows.net",
	  "fs.azure.account.key.mystorageaccount.blob.core.windows.net": ""
     }
}
  

取得閘道設定

此作業會擷取叢集網關 HTTP 認證。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
POST https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/getGatewaySettings?api-version={api-version}

回應

HTTP 200 (OK) 成功完成作業。

範例回應:

{  
     "restAuthCredential.isEnabled": true,  
     "restAuthCredential.username": "username",  
     "restAuthCredential.password": "Password123!"  
}  

更新閘道設定

這項作業可讓使用者變更叢集網關 HTTP 認證。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
POST https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/updateGatewaySettings?api-version={api-version}
{  
     "restAuthCredential.isEnabled": true,  
     "restAuthCredential.username": "username",  
     "restAuthCredential.password": "Password123!"  
}  

回應

HTTP 202 (成功完成作業時已接受) 。

(已淘汰) 變更連線設定

這項作業可讓使用者啟用/停用叢集的 HTTPS 連線。

請改用 updateGatewaySettings

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
POST https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/configurations/{configuration Type}?api-version={api-version}

啟用連線能力

{  	
   "restAuthCredential.isEnabled": true,  	
   "restAuthCredential.username": "user",  	
   "restAuthCredential.password": "password here"  
}

依資源群組列出

清單 指定資源群組中用戶訂用帳戶中的所有叢集。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
GET https://management.azure.com/subscriptions/{subscription Id}/resourcegroups/{resourceGroup Id}/providers/Microsoft.HDInsight/clusters?api-version={api-version}

回應

如果要求成功完成,作業會傳回 200 (OK) 。

狀態代碼:200 確定

回應本文是叢集詳細數據的陣列。 如需詳細資訊,請參閱 取得叢集屬性

{  
  "value": [  
		{ Cluster details }  
    ]  
}  
  

依訂用帳戶列出

清單 使用者訂用帳戶中的所有叢集。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
GET https://management.azure.com/subscriptions/{subscription Id}/providers/Microsoft.HDInsight/clusters?api-version={api-version}

回應

如果要求成功完成,作業會傳回 200 (OK) 。

狀態代碼: 200 確定

回應本文是叢集詳細數據的陣列。

{  
  "value": [  
		{ Cluster details }  
    ]  
}  

停用連線能力

{  
   "restAuthCredential.isEnabled": false  
}  
  
元素名稱 必要 類型 Description
restAuthCredential.isEnabled Boolean 指定是否應啟用或停用連線
restAuthCredential.username String 如果isEnabled=true,則為必要專案
指定連線設定的用戶名稱
restAuthCredential.password String 如果isEnabled=true,則為必要專案
指定連線設定的密碼

回應

HTTP 202 (已接受) 表示作業會以異步方式完成。 異步輪詢會在作業成功完成後傳回 204 (NoContent) 。

備註

若要追蹤刪除叢集要求的進度,請參閱 異步操作 (202 已接受和位置標頭)

(Windows 叢集) 變更 RDP 設定

這項作業可讓用戶啟用/停用 RDP。 它適用於 Windows 型叢集。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
POST https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/changerdpsetting?api-version={api-version}

要求本文

啟用 RDP

{  
	"osProfile": {  
        "windowsOperatingSystemProfile": {  
        	"rdpSettings": {  
        	      "username": "username",  
            	      "password": "password here",  
            	      "expiryDate": "YYYY-MM-DD"  
        	}  
        }  
    }  
}  

停用 RDP

{  
	"osProfile": {  
        "windowsOperatingSystemProfile": {  
        	"rdpSettings": null  
        }  
    }  
}  

osProfile

元素名稱 必要 類型 Description
windowsOperatingSystemProfile No 複雜類型 指定 Windows OS 相關設定

windowsOperatingSystemProfile

元素名稱 必要 類型 Description
rdpSettings No 複雜類型 指定 Windows 叢集的 RDP 設定

rdpSettings

元素名稱 必要 類型 描述
username 字串 指定 RDP 用戶名稱
密碼 字串 指定 RDP 用戶的密碼
expiryDate Date RDP 認證的到期日

回應

如果要求成功完成,作業會傳回 200 (確定)

狀態代碼: 200 確定

回應本文與 建立叢集相同。

只在執行中的叢集上執行腳本動作, (Linux 叢集)

在執行中的叢集上執行腳本動作。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
POST https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/executeScriptActions?api-version={api-version}

要求本文

{  
  "scriptActions": [  
    {  
      "name": "script-name",  
      "uri": "script-uri",  
      "parameters": "script-parameters",  
      "roles": [  
        "headnode",  
        "workernode"  
      ]  
    },  
    ...  
  ],  
  "persistOnSuccess": true  
}  
  

scriptActions

元素名稱 必要 類型 Description
NAME 字串 指定文稿動作的名稱
uri 字串 指定文稿動作的 URI
參數 字串 指定文稿動作所需的參數
角色 Yes 字串陣列 指定文稿動作執行的目標角色
persistOnSuccess Boolean 指定文稿動作是否會在成功執行之後保存

回應

如果驗證已完成且已接受要求,作業會傳回 202 (已接受) 。

狀態代碼: 202 (已接受)

僅列出叢集 (Linux 叢集的所有持續性腳本動作)

此作業會傳回指定叢集的所有持續性腳本動作。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
GET https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/scriptActions?api-version={api-version}

回應

HTTP 200 (確定) 作業成功完成。

狀態代碼: 200 確定

範例回應:

{  
"value":  
[  
  {  
    "name":"script-name",  
    "uri":"script-uri",  
    "parameters":"script-parameters",  
    "roles":["headnode","workernode"],  
    "applicationName":null  
  },  
  ...  
]  
}  
元素名稱 類型 Description
NAME String 指定文稿動作的名稱。
uri 字串 指定文稿動作的 URI。
參數 字串 指定文稿動作所需的參數
角色 字串陣列 指定文稿動作執行的目標角色。
applicationName String 指定與文稿相關聯的對應應用程式。 如果腳本是由使用者提供,applicationName 為 Null

僅移除叢集 (Linux 叢集的持續性腳本動作)

此作業會移除叢集的 HDInsight 保存腳本動作。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
DELETE https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/scriptActions/{script Name}?api-version={api-version}

回應

  • HTTP 200 (OK) ,表示腳本動作已從保存的腳本動作清單中移除。

  • HTTP 404 (NotFound) ,表示沒有具有對應 scriptName 的現有持續性腳本動作。

僅從Linux叢集 (的歷程記錄取得腳本動作執行)

此作業會傳回指定之叢集執行的最新腳本動作執行,或個別腳本執行的執行詳細數據。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
GET https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/scriptExecutionHistory/{script Execution Id}?api-version={api-version}

回應

如果要求成功完成,作業會傳回 200 (OK) 。 回應本文是腳本執行詳細數據的陣列,如果提供 scriptExecutionId,則為單一腳本執行詳細數據。 以下是腳本執行詳細數據的範例。

狀態代碼: 200 (OK)

範例回應:

{  
  "scriptExecutionId":script-execution-id,  
  "name":"script-name",  
  "applicationName":null,  
  "uri":"script-uri",  
  "parameters":"script-parameters",  
  "roles":["headnode","workernode"],  
  "startTime":"2016-02-26T23:49:13.0773637Z",  
  "endTime":"2016-02-26T23:49:33.4964725Z",  
  "status":"Succeeded",  
  "operation":"PostClusterCreateScriptActionRequest",  
  "executionSummary":  
	[{"status":"COMPLETED",  
	 "instanceCount":4}],  
  "debugInformation": "debug-information"  
}  
  
元素名稱 類型 Description
scriptExecutionId long 指定文稿動作的執行識別碼。
NAME String 指定文稿動作的名稱。
applicationName String 指定與文稿相關聯的對應應用程式。 如果腳本是由使用者提供,applicationName 為 null
uri 字串 指定文稿動作的 URI。
參數 字串 指定文稿動作所需的參數
角色 字串陣列 指定文稿動作執行的目標角色。
startTime DateTime 指定文稿動作執行的開始時間
EndTime DateTime 指定文稿動作執行的結束時間
status String 指定文稿動作執行的狀態
operation (作業) 字串 指定執行文稿動作的原因。 例如,ScaleUp 表示腳本動作是在叢集相應增加期間執行。
executionSummary 複雜類型的陣列 指定執行摘要,以執行腳本的主機數目和主機數目失敗。
debugInformation 字串 指定文稿的詳細偵錯資訊。 只有在要求中提供 scriptExecutionId 時,才會傳回 debugInformation。

executionSummary

元素名稱 類型 描述
status String 指定個別主機上執行的狀態。
instanceCount Int 指定具有對應狀態的執行數目。

將腳本從腳本動作執行歷程記錄升級為只保存 (Linux 叢集)

此作業會將 HDInsight 腳本從腳本執行歷程記錄升階為保存狀態。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
POST https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/scriptExecutionHistory/{script Execution Id}/promote?api-version={api-version}

回應

  • HTTP 200 (OK) 表示腳本動作已升級。

  • HTTP 404 (NotFound) ,表示沒有具有對應 scriptExecutionId 的現有腳本動作執行。

調整大小

調整現有的 HDInsight 叢集大小。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
POST https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}/roles/{role name}/resize?api-version={api-version}

以下顯示更新叢集標籤標的範例要求

{  
    "targetInstanceCount": 10  
}  
元素名稱 必要 類型 Description
targetInstanceCount Yes Int 指定角色的新實例計數

回應

HTTP 202 (已接受) 表示作業會以異步方式完成。 異步輪詢會在作業成功完成之後傳回 204 (NoContent) 。

備註

若要追蹤刪除叢集要求的進度,請參閱 異步操作 (202 已接受和位置標頭)

更新

匯報 叢集的標籤。

所有其他更新都是個別描述的動作。

要求

如需叢集所使用的標頭和參數,請參閱 一般參數和標頭

方法 要求 URI
PATCH https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroup Name}/providers/Microsoft.HDInsight/clusters/{cluster name}?api-version={api-version}

以下顯示更新叢集標籤標的範例要求

{   
    "tags": {"department": "finance"}  
}  
  
元素名稱 必要 類型 Description
tags 字串 指定將指派給叢集的標記。 如需使用標籤的詳細資訊,請參閱 使用標籤來組織您的 Azure 資源

回應

如果要求順利完成,作業會傳回 200 (OK) 。

狀態代碼: 200 確定

回應本文與 建立叢集相同。