你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

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 是的 字符串 指定集群的资源标识符。
姓名 是的 字符串 指定群集的名称。
类型 是的 字符串 指定集群的类型。
位置 是的 字符串 指定应在其中创建群集的受支持的 Azure 位置。 有关详细信息,请参阅 列出所有可用的地理位置
tags 字符串 指定将分配给集群的标记。 有关使用标记的详细信息,请参阅 使用标记来组织 Azure 资源
性能 是的 复杂类型 指定集群的属性。

属性

元素名称 必选 类型 DESCRIPTION
clusterVersion 是的 字符串 指定集群版本
操作系统类型 是的 字符串 指定集群的作系统。

有效值为 LinuxWindows
cluster定义 是的 复杂类型 指定有关集群类型和配置的信息
计算配置文件 是的 复杂类型 指定有关集群拓扑和关联角色属性的信息

cluster定义

元素名称 必选 类型 DESCRIPTION
kind 是的 字符串 指定集群类型。

有效值为 hadoop、hbase、storm 和 spark
配置 是的 字典 此元素是配置类型的字典及其关联的值字典。

网关配置类型用于配置用于连接到 Web API 和 Ambari 门户的 http 用户

核心站点配置类型用于配置群集的默认存储帐户

computeProfile

元素名称 必选 类型 DESCRIPTION
clusterVersion 是的 字符串 指定集群版本
角色 是的 复杂类型数组(角色) 指定有关群集中角色的信息

角色

元素名称 必选 类型 DESCRIPTION
姓名 是的 字符串 指定角色名称
targetInstanceCount 是的 整数 指定角色的目标实例计数
硬件配置文件 是的 复杂类型 指定有关角色的硬件配置文件的信息
os简介 是的 复杂类型 指定有关角色的作系统配置文件的信息

hardwareProfile

元素名称 必选 类型 DESCRIPTION
vmSize 是的 字符串 指定虚拟机的大小。 有关有效大小,请参阅 HDInsight 配置选项 (进入此链接后,向下滚动到 “节点定价层”)

osProfile

元素名称 必选 类型 DESCRIPTION
linux作系统系统配置文件 复杂类型 指定与 linux OS 相关的设置
windows作系统配置文件 复杂类型 指定与 Windows作系统相关的设置
虚拟网络配置文件 复杂类型 如果群集部署在用户订阅中的虚拟网络中,则指定与虚拟网络相关的设置
脚本作 复杂类型的数组 要在集群上执行的脚本作列表

linuxOperatingSystem配置文件

元素名称 必选 类型 DESCRIPTION
用户名 是的 字符串 SSH 用户名
ssh配置文件 复杂类型 指定 SSH 密钥。

需要 sshProfile 或 Password 之一。
密码 字符串 指定 SSH 密码

需要 sshProfile 或 Password 之一。

ssh配置文件

元素名称 必选 类型 DESCRIPTION
publicKeys 是的 数组 包含 certificateData 对象的列表。 该值是 ssh-rsa 公钥

windows作系统配置文件

元素名称 必选 类型 DESCRIPTION
rdp设置 复杂类型 指定 Windows 群集的 RDP 设置

rdp设置

元素名称 必选 类型 DESCRIPTION
用户名 是的 字符串 指定 RDP 用户名
密码 是的 字符串 指定 RDP 用户的密码
expiryDate 是的 日期 RDP 凭据的到期日期

virtualNetworkProfile

元素名称 必选 类型 DESCRIPTION
id 是的 字符串 虚拟网络资源 ID
子网 是的 字符串 指定子网名称

scriptActions

元素名称 必选 类型 DESCRIPTION
姓名 是的 字符串 脚本作的友好名称
uri 是的 字符串 脚本作文件的 URL
参数 字符串 执行脚本作文件时要传递的参数

响应

如果验证完成并接受请求,则作将返回 200 (OK) 。

状态代码: 200 OK

使用 ssh 键创建的 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"  
                    }  
  
                },  
                {  
                    "name": "workernode",  
  
                    "targetInstanceCount": 1,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    }  
                },  
                {  
                    "name": "zookeepernode",  
  
                    "targetInstanceCount": 3,  
  
                    "hardwareProfile": {  
                        "vmSize": "Small"  
                    }  
                }  
            ]  
        }  
    }  
}  
  
元素名称 类型 DESCRIPTION
provisioningState 字符串 指示当前预配状态。
clusterState 字符串 指示预配过程中更详细的 HDInsight 群集状态。
创建日期 日期 收到群集创建请求的日期时间
quotaInfo 复杂类型 指定群集使用的内核
错误 错误消息数组 如果 provisioningState = 'failed',则包含错误消息
连接端点 复杂类型 指定集群的公共终结点

connectivityEndpoints

元素名称 类型 DESCRIPTION
姓名 字符串 连接终结点的友好名称
协议 字符串 指定要使用的协议(例如:HTTPS、SSH)
位置 字符串 指定要连接的 URL
移植 整数 (int) 指定要连接的端口

创建已加入域的高级 HDInsight 群集(仅限 Linux,预览版)

使用 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 是的 字符串 指定集群的资源标识符。
姓名 是的 字符串 指定群集的名称。
类型 是的 字符串 指定集群的类型。
位置 是的 字符串 指定应在其中创建群集的受支持的 Azure 位置。 有关详细信息,请参阅 列出所有可用的地理位置
tags 字符串 指定将分配给集群的标记。 有关使用标记的详细信息,请参阅 使用标记来组织 Azure 资源
性能 是的 复杂类型 指定集群的属性。

属性

元素名称 必选 类型 DESCRIPTION
clusterVersion 是的 字符串 指定集群版本
操作系统类型 是的 字符串 指定集群的作系统。

有效值为 Linux ,因为只有 Linux 群集类型可以加入 Azure AD 域。
分层 字符串 默认值为 标准值。 有效值为 标准 值和 高级值。 如果未指定值,则假定该值为 标准值。 指定集群的层。 已加入域的群集仅在高级层中受支持
cluster定义 是的 复杂类型 指定有关集群类型和配置的信息
计算配置文件 是的 复杂类型 指定有关集群拓扑和关联角色属性的信息
安全配置文件 复杂类型 如果正在创建已加入域的安全群集,则此元素指定与 Active Directory 相关的设置

cluster定义

元素名称 必选 类型 DESCRIPTION
kind 是的 字符串 指定集群类型。

有效值为 hadoop、hbase、storm 和 spark
配置 是的 字典 此元素是配置类型的字典及其关联的值字典。

网关配置类型用于配置用于连接到 Web API 和 Ambari 门户的 http 用户

核心站点配置类型用于配置群集的默认存储帐户

computeProfile

元素名称 必选 类型 DESCRIPTION
clusterVersion 是的 字符串 指定集群版本
角色 是的 复杂类型数组(角色) 指定有关群集中角色的信息

securityProfile

元素名称 必选 类型 DESCRIPTION
directoryType 是的 字符串 使用的 LDAP 目录类型。 目前,“ActiveDirectory”是唯一支持的值。
是的 字符串 群集的 Active Directory 域
organizationUnitDN 是的 字符串 将在 Active Directory 中创建用户和计算机帐户的组织单位的可分辨名称
ldapsUrls 是的 字符串数组 Active Directory 的一个或多个 LDAPS 服务器的 URL
domainUserName 是的 字符串 具有创建集群的足够权限的域用户帐户。 它应该采用 user@domain 格式
domainUserPassword 域名用户密码 是的 字符串 域用户帐户的密码
clusterUsers组DNS 字符串数组 将在 Ambari 和 Apache Ranger 中提供的 Active Directory 组的可分辨名称

角色

元素名称 必选 类型 DESCRIPTION
姓名 是的 字符串 指定角色名称
targetInstanceCount 是的 整数 指定角色的目标实例计数
硬件配置文件 是的 复杂类型 指定有关角色的硬件配置文件的信息
os简介 是的 复杂类型 指定有关角色的作系统配置文件的信息

hardwareProfile

元素名称 必选 类型 DESCRIPTION
vmSize 是的 字符串 指定虚拟机的大小。 有关有效大小,请参阅 HDInsight 配置选项 (进入此链接后,向下滚动到 “节点定价层”)

osProfile

元素名称 必选 类型 DESCRIPTION
linux作系统系统配置文件 复杂类型 指定与 linux OS 相关的设置
虚拟网络配置文件 复杂类型 如果群集部署在用户订阅中的虚拟网络中,则指定与虚拟网络相关的设置
脚本作 复杂类型的数组 要在集群上执行的脚本作列表

linuxOperatingSystem配置文件

元素名称 必选 类型 DESCRIPTION
用户名 是的 字符串 SSH 用户名
ssh配置文件 复杂类型 指定 SSH 密钥。

需要 sshProfile 或 Password 之一。
密码 字符串 指定 SSH 密码

需要 sshProfile 或 Password 之一。

ssh配置文件

元素名称 必选 类型 DESCRIPTION
publicKeys 是的 数组 包含 certificateData 对象的列表。 该值是 ssh-rsa 公钥

virtualNetworkProfile

元素名称 必选 类型 DESCRIPTION
id 是的 字符串 虚拟网络资源 ID
子网 是的 字符串 指定子网名称

scriptActions

元素名称 必选 类型 DESCRIPTION
姓名 是的 字符串 脚本作的友好名称
uri 是的 字符串 脚本作文件的 URL
参数 字符串 执行脚本作文件时要传递的参数

响应

如果验证完成并接受请求,则作将返回 200 (OK) 。

状态代码: 200 OK

使用 ssh 键创建的 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"  
                    }  
  
                },  
                {  
                    "name": "workernode",  
  
                    "targetInstanceCount": 1,  
  
                    "hardwareProfile": {  
                        "vmSize": "Large"  
                    }  
                },  
                {  
                    "name": "zookeepernode",  
  
                    "targetInstanceCount": 3,  
  
                    "hardwareProfile": {  
                        "vmSize": "Small"  
                    }  
                }  
            ]  
        }  
    }  
}  
  
元素名称 类型 DESCRIPTION
provisioningState 字符串 指示当前预配状态。
clusterState 字符串 指示预配过程中更详细的 HDInsight 群集状态。
创建日期 日期 收到群集创建请求的日期时间
quotaInfo 复杂类型 指定群集使用的内核
错误 错误消息数组 如果 provisioningState = 'failed',则包含错误消息
连接端点 复杂类型 指定集群的公共终结点

connectivityEndpoints

元素名称 类型 DESCRIPTION
姓名 字符串 连接终结点的友好名称
协议 字符串 指定要使用的协议(例如:HTTPS、SSH)
位置 字符串 指定要连接的 URL
移植 整数 (int) 指定要连接的端口

创建将 Azure Data Lake Store 作为默认文件系统的群集

在指定的订阅中创建群集,将 Azure Data Lake Store 作为默认文件系统。 在请求正文中提供 ClusterIdentity 对象,并使用适当的 Data Lake Store URL 配置 default-filesystem 属性。

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 是的 字符串 指定集群的资源标识符。
姓名 是的 字符串 指定群集的名称。
类型 是的 字符串 指定集群的类型。
位置 是的 字符串 指定应在其中创建群集的受支持的 Azure 位置。 有关详细信息,请参阅 列出所有可用的地理位置
tags 字符串 指定将分配给集群的标记。 有关使用标记的详细信息,请参阅 使用标记来组织 Azure 资源
性能 是的 复杂类型 指定集群的属性。

属性

元素名称 必选 类型 DESCRIPTION
clusterVersion 是的 字符串 指定集群版本
操作系统类型 是的 字符串 指定集群的作系统。

有效值为 Linux
分层 字符串 指定集群的层。 有效值为 标准 值和 高级值。 如果未指定层,则群集将为标准层。
cluster定义 是的 复杂类型 指定有关集群类型和配置的信息
计算配置文件 是的 复杂类型 指定有关集群拓扑和关联角色属性的信息

cluster定义

元素名称 必选 类型 DESCRIPTION
kind 是的 字符串 指定集群类型。

有效值为 hadoop、hbase、storm 和 spark
配置 是的 字典 此元素是配置类型的字典及其关联的值字典。

网关配置类型用于配置用于连接到 Web API 和 Ambari 门户的 http 用户

核心站点配置类型用于配置群集的默认存储帐户

computeProfile

元素名称 必选 类型 DESCRIPTION
clusterVersion 是的 字符串 指定集群版本
角色 是的 复杂类型数组(角色) 指定有关群集中角色的信息

角色

元素名称 必选 类型 DESCRIPTION
姓名 是的 字符串 指定角色名称
targetInstanceCount 是的 整数 指定角色的目标实例计数
硬件配置文件 是的 复杂类型 指定有关角色的硬件配置文件的信息
os简介 是的 复杂类型 指定有关角色的作系统配置文件的信息

hardwareProfile

元素名称 必选 类型 DESCRIPTION
vmSize 是的 字符串 指定虚拟机的大小。 有关有效大小,请参阅 HDInsight 配置选项 (进入此链接后,向下滚动到 “节点定价层”)

osProfile

元素名称 必选 类型 DESCRIPTION
linux作系统系统配置文件 复杂类型 指定与 linux OS 相关的设置
虚拟网络配置文件 复杂类型 如果群集部署在用户订阅中的虚拟网络中,则指定与虚拟网络相关的设置
脚本作 复杂类型的数组 要在集群上执行的脚本作列表

linuxOperatingSystem配置文件

元素名称 必选 类型 DESCRIPTION
用户名 是的 字符串 SSH 用户名
ssh配置文件 复杂类型 指定 SSH 密钥。

需要 sshProfile 或 Password 之一。
密码 字符串 指定 SSH 密码

需要 sshProfile 或 Password 之一。

ssh配置文件

元素名称 必选 类型 DESCRIPTION
publicKeys 是的 数组 包含 certificateData 对象的列表。 该值是 ssh-rsa 公钥

virtualNetworkProfile

元素名称 必选 类型 DESCRIPTION
id 是的 字符串 虚拟网络资源 ID
子网 是的 字符串 指定子网名称

scriptActions

元素名称 必选 类型 DESCRIPTION
姓名 是的 字符串 脚本作的友好名称
uri 是的 字符串 脚本作文件的 URL
参数 字符串 执行脚本作文件时要传递的参数

响应

如果验证完成并接受请求,则作将返回 200 (OK) 。

状态代码: 200 OK

使用 ssh 键创建的 Linux 集群的响应正文:

{
	"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 群集状态。
创建日期 日期 收到群集创建请求的日期时间
quotaInfo 复杂类型 指定群集使用的内核
错误 错误消息数组 如果 provisioningState = 'failed',则包含错误消息
连接端点 复杂类型 指定集群的公共终结点

connectivityEndpoints

元素名称 类型 DESCRIPTION
姓名 字符串 连接终结点的友好名称
协议 字符串 指定要使用的协议(例如:HTTPS、SSH)
位置 字符串 指定要连接的 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 Accepted 和 Location 标头)

获取

获取指定集群的详细信息/属性。

请求

有关集群使用的标头和参数,请参阅通用参数和标头。

方法 请求 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 OK

响应正文与创建集群相同。

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 群集状态。
创建日期 日期 收到群集创建请求的日期时间
quotaInfo 复杂类型 指定群集使用的内核
错误 错误消息数组 如果 provisioningState = 'failed',则包含错误消息
连接端点 复杂类型 指定集群的公共终结点

connectivityEndpoints

元素名称 类型 DESCRIPTION
姓名 字符串 连接终结点的友好名称
协议 字符串 指定要使用的协议(例如:HTTPS、SSH)
位置 字符串 指定要连接的 URL
移植 整数 (int) 指定要连接的端口

列出配置

检索所有集群配置详细信息(包括敏感信息)。

请求

有关集群使用的标头和参数,请参阅通用参数和标头。

方法 请求 URI
帖子 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
帖子 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
帖子 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
帖子 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 OK

响应正文是集群详细信息的数组。 有关详细信息,请参阅 获取群集属性

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

按订阅列出

列出用户订阅中的所有群集。

请求

有关集群使用的标头和参数,请参阅通用参数和标头。

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

响应

如果请求成功完成,该作将返回 200 (OK)。

状态代码: 200 OK

响应正文是集群详细信息的数组。

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

禁用连接

{  
   "restAuthCredential.isEnabled": false  
}  
  
元素名称 必选 类型 DESCRIPTION
restAuthCredential.is启用 是的 布尔 指定是否应启用或禁用连接
restAuthCredential.用户名 字符串 如果 isEnabled=true,则为必填项
指定连接设置的用户名
restAuthCredential.密码 字符串 如果 isEnabled=true,则为必填项
指定连接设置的密码

响应

HTTP 202 (已接受) 以指示作将异步完成。 作成功完成后,异步轮询将返回 204 (NoContent)。

注解

若要跟踪删除群集请求的进度,请参阅 异步作(202 Accepted 和 Location 标头)

更改 RDP 设置(仅限 Windows 群集)

此作允许用户启用/禁用 RDP。 它适用于基于 Windows 的集群。

请求

有关集群使用的标头和参数,请参阅通用参数和标头。

方法 请求 URI
帖子 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
windows作系统配置文件 复杂类型 指定与 Windows作系统相关的设置

windows作系统配置文件

元素名称 必选 类型 DESCRIPTION
rdp设置 复杂类型 指定 Windows 群集的 RDP 设置

rdp设置

元素名称 必选 类型 DESCRIPTION
用户名 是的 字符串 指定 RDP 用户名
密码 是的 字符串 指定 RDP 用户的密码
expiryDate 是的 日期 RDP 凭据的到期日期

响应

如果请求成功完成,该作将返回 200 (OK)

状态代码: 200 OK

响应正文与 创建集群相同。

在正在运行的集群上运行脚本作(仅限 Linux 集群)

在正在运行的集群上执行脚本作。

请求

有关集群使用的标头和参数,请参阅通用参数和标头。

方法 请求 URI
帖子 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
姓名 是的 字符串 指定脚本作的名称
uri 是的 字符串 指定脚本作的 URI
参数 是的 字符串 指定脚本作所需的参数
角色 是的 字符串数组 指定脚本作执行的目标角色
持续成功 是的 布尔 指定脚本作在成功执行后是否将保留

响应

如果验证完成并接受请求,则作将返回 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 (OK)。

状态代码: 200 OK

示例响应:

{  
"value":  
[  
  {  
    "name":"script-name",  
    "uri":"script-uri",  
    "parameters":"script-parameters",  
    "roles":["headnode","workernode"],  
    "applicationName":null  
  },  
  ...  
]  
}  
元素名称 类型 DESCRIPTION
姓名 字符串 指定脚本操作的名称。
uri 字符串 指定脚本作的 URI。
参数 字符串 指定脚本作所需的参数
角色 字符串数组 指定执行脚本作的目标角色。
应用程序名称 字符串 指定与脚本关联的相应应用程序。 如果脚本由用户提供,则 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(确定)

示例响应:

{  
  "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 长整型 指定脚本作的执行 ID。
姓名 字符串 指定脚本操作的名称。
应用程序名称 字符串 指定与脚本关联的相应应用程序。 如果脚本由用户提供,则 applicationName 为 null
uri 字符串 指定脚本作的 URI。
参数 字符串 指定脚本作所需的参数
角色 字符串数组 指定执行脚本作的目标角色。
开始时间 日期/时间 指定脚本作执行的开始时间
结束时间 日期/时间 指定脚本作执行的结束时间
状态 字符串 指定脚本作执行的状态
操作 字符串 指定执行脚本作的原因。 例如,ScaleUp 表示在集群纵向扩展期间执行了脚本作。
execution摘要 复杂类型的数组 根据成功执行脚本的主机数和失败执行脚本的主机数指定执行摘要。
调试信息 字符串 指定脚本的详细调试信息。 仅当在请求中提供 scriptExecutionId 时,才会返回 debugInformation。

execution摘要

元素名称 类型 DESCRIPTION
状态 字符串 指定在各个主机上执行的状态。
instanceCount int (整数) 指定具有相应状态的执行次数。

将脚本作执行历史记录中的脚本提升为持久化(仅限 Linux 集群)

此作将脚本执行历史记录中的 HDInsight 脚本提升为持久性。

请求

有关集群使用的标头和参数,请参阅通用参数和标头。

方法 请求 URI
帖子 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
帖子 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 是的 int (整数) 指定角色的新实例计数

响应

HTTP 202 (已接受) 以指示作将异步完成。 作成功完成后,异步轮询将返回 204 (NoContent)。

注解

若要跟踪删除群集请求的进度,请参阅 异步作(202 Accepted 和 Location 标头)

更新

更新集群的标记。

所有其他更新都是单独描述的单独作。

请求

有关集群使用的标头和参数,请参阅通用参数和标头。

方法 请求 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 OK

响应正文与 创建集群相同。