如何使用ARM模板获取HDI集群的私有IP

时间:2017-04-11 08:01:24

标签: azure hdinsight arm-template

我创建了template1,它将部署HDI集群和template2,它将单独部署Azure VM。

现在,我想从群集中获取头节点专用IP,并将其传递给Azure VM模板,以便使用ARM模板进行处理。

我该怎么办?

1 个答案:

答案 0 :(得分:1)

考虑到这是您从HDcluster获得的对象:

{
    "id": "xxx",
    "name": "xxx",
    "type": "Microsoft.HDInsight/clusters",
    "location": "East US",
    "etag": "xxx",
    "tags": null,
    "properties": {
        "clusterVersion": "3.5.1000.0",
        "osType": "Linux",
        "clusterDefinition": {
            "blueprint": "https://blueprints.azurehdinsight.net/spark-3.5.1000.0.9865375.json",
            "kind": "SPARK",
            "componentVersion": {
                "Spark": "1.6"
            }
        },
        "computeProfile": {
            "roles": [
                {
                    "name": "headnode",
                    "targetInstanceCount": 2,
                    "hardwareProfile": {
                        "vmSize": "ExtraLarge"
                    },
                    "osProfile": {
                        "linuxOperatingSystemProfile": {
                            "username": "sshuser"
                        }
                    }
                },
                {
                    "name": "workernode",
                    "targetInstanceCount": 1,
                    "hardwareProfile": {
                        "vmSize": "Large"
                    },
                    "osProfile": {
                        "linuxOperatingSystemProfile": {
                            "username": "sshuser"
                        }
                    }
                },
                {
                    "name": "zookeepernode",
                    "targetInstanceCount": 3,
                    "hardwareProfile": {
                        "vmSize": "Medium"
                    },
                    "osProfile": {
                        "linuxOperatingSystemProfile": {
                            "username": "sshuser"
                        }
                    }
                }
            ]
        },
        "provisioningState": "Succeeded",
        "clusterState": "Running",
        "createdDate": "2017-04-11T09:07:44.68",
        "quotaInfo": {
            "coresUsed": 20
        },
        "connectivityEndpoints": [
            {
                "name": "SSH",
                "protocol": "TCP",
                "location": "xxx.azurehdinsight.net",
                "port": 22
            },
            {
                "name": "HTTPS",
                "protocol": "TCP",
                "location": "xxx.azurehdinsight.net",
                "port": 443
            }
        ],
        "tier": "standard"
    }
}

我猜这是你能得到的最好的输出,所以你可以使用类似的东西:

"outputs": {
    "test": {
        "type": "Object",
        "value": "[reference(parameters('clusterName'),'2015-03-01-preview').connectivityEndpoints[0].location]"
    }
}

这将为您提供xxx.azurehdinsight.net

的输出

您可以使用此数据创建新部署,或者(就像我说的那样)将RHEL VM添加到同一模板并在HDCluster部署中使其成为dependOn并引用与VMextension的输入相同的内容