2017-04-26 5 views
0

ARM 템플릿과 Ambari API를 사용하여 에지 노드의 개별 IP를 얻는 방법은 무엇입니까?Azure에서 ARM 템플릿 또는 Ambari API를 사용하여 에지 노드의 개별 IP를 얻는 방법

ARM 템플릿의 다음 edgenode 부분을 사용하여 Edge 노드를 설치하고 있습니다. 내 사용자 지정 응용 프로그램에 대해 개인 IP Edge 노드를 가져 오려고합니다. edgenodeName을 사용하여 ARM 템플릿을 사용하거나 Ambari를 사용하여 어떻게 가져올 수 있습니까?

{ 
    'name': '[concat(parameters('clusterName'),'/', parameters('edgenodeName'))]', 
    'type': 'Microsoft.HDInsight/clusters/applications', 
    'apiVersion': '2015-03-01-preview', 
    'dependsOn': [ 
     '[concat('Microsoft.HDInsight/clusters/', parameters('clusterName'))]' 
    ], 
    'properties': { 
    'marketPlaceIdentifier': 'EmptyEdgeNode', 
    'computeProfile': { 
     'roles': [{ 
     'name': 'edgenode', 
     'targetInstanceCount': 1, 
     'hardwareProfile': { 
      'vmSize': '[parameters('edgenodeSize')]' 
     } 
     }] 
    }, 
    'installScriptActions': [], 
    'uninstallScriptActions': [], 
    'httpsEndpoints': [], 
    'applicationType': 'CustomApplication' 
    } 
} 

업데이트 1 : -

여기 당신은 에지 노드 IP를 얻을 수 Ambari API을 사용할 수 resources.azure.com

{ 
    "id": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.HDInsight/clusters/$clusterName", 
    "name": "$clusterName", 
    "type": "Microsoft.HDInsight/clusters", 
    "location": "Central US", 
    "etag": "33908087-88d4-43e6-bad4-7668bb90fa39", 
    "tags": null, 
    "properties": { 
    "clusterVersion": "3.5.1000.0", 
    "osType": "Linux", 
    "clusterDefinition": { 
     "blueprint": "https://blueprints.azurehdinsight.net/spark-3.5.1000.0.9988582.json", 
     "kind": "SPARK", 
     "componentVersion": { 
     "Spark": "1.6" 
     } 
    }, 
    "computeProfile": { 
     "roles": [ 
     { 
      "name": "headnode", 
      "targetInstanceCount": 2, 
      "hardwareProfile": { 
      "vmSize": "Standard_D12_V2" 
      }, 
      "osProfile": { 
      "linuxOperatingSystemProfile": { 
       "username": "$userName" 
      } 
      }, 
      "virtualNetworkProfile": { 
      "id": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vnetName", 
      "subnet": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vnetName/subnets/default" 
      } 
     }, 
     { 
      "name": "workernode", 
      "targetInstanceCount": 1, 
      "hardwareProfile": { 
      "vmSize": "Standard_D12_V2" 
      }, 
      "osProfile": { 
      "linuxOperatingSystemProfile": { 
       "username": "$userName" 
      } 
      }, 
      "virtualNetworkProfile": { 
      "id": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vnetName", 
      "subnet": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vnetName/subnets/default" 
      } 
     }, 
     { 
      "name": "zookeepernode", 
      "targetInstanceCount": 3, 
      "hardwareProfile": { 
      "vmSize": "Medium" 
      }, 
      "osProfile": { 
      "linuxOperatingSystemProfile": { 
       "username": "$userName" 
      } 
      }, 
      "virtualNetworkProfile": { 
      "id": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vnetName", 
      "subnet": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vnetName/subnets/default" 
      } 
     }, 
     { 
      "name": "edgenode1", 
      "targetInstanceCount": 1, 
      "hardwareProfile": { 
      "vmSize": "Standard_D3_v2" 
      }, 
      "osProfile": { 
      "linuxOperatingSystemProfile": { 
       "username": "$userName" 
      } 
      }, 
      "virtualNetworkProfile": { 
      "id": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vnetName", 
      "subnet": "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vnetName/subnets/default" 
      } 
     } 
     ] 
    }, 
    "provisioningState": "Succeeded", 
    "clusterState": "Running", 
    "createdDate": "2017-04-26T07:44:54.4", 
    "quotaInfo": { 
     "coresUsed": 16 
    }, 
    "connectivityEndpoints": [ 
     { 
     "name": "SSH", 
     "protocol": "TCP", 
     "location": "$clusterName-ssh.azurehdinsight.net", 
     "port": 22 
     }, 
     { 
     "name": "HTTPS", 
     "protocol": "TCP", 
     "location": "$clusterName.azurehdinsight.net", 
     "port": 443 
     } 
    ], 
    "tier": "standard" 
    } 
} 
+0

택시가 클러스터의 JSON 표현을 붙여? resources.azure.com으로 이동하여 클러스터로 이동하여 json을 질문에 붙여 넣으십시오. – 4c74356b41

+0

@ 4c74356b41 지금 클러스터가 없습니다. 클러스터를 만들어야합니다. 지금 당장 ARM 템플릿 만 있습니다 – karan

+0

그걸로 행운을;) – 4c74356b41

답변

1

에서 내 JSON 표현입니다. 템플릿 배포가 성공하면 다음 스크립트를 사용하여 에지 노드 IP를 나열 할 수 있습니다.

#!/bin/bash 
PASSWORD=$1 
CLUSTERNAME=$2 
###list all host private IP 
for HOSTNAME in $(curl -u admin:$PASSWORD -sS -G "https://$CLUSTERNAME.azurehdinsight.net/api/v1/clusters/$CLUSTERNAME/hosts" | jq -r '.items[].Hosts.host_name') 
do 
    IP=$(curl -u admin:$PASSWORD -sS -G "https://$CLUSTERNAME.azurehdinsight.net/api/v1/clusters/$CLUSTERNAME/hosts/$HOSTNAME" | jq -r '.Hosts.ip') 
    echo "$HOSTNAME <--> $IP" >>host.txt 
done 
cat host.txt |grep '^ed'|awk -F\> '{print $2 }' 

host.txt에서 모든 호스트 IP를 얻을 수 있습니다.

ed11-******.gx.internal.cloudapp.net <--> 10.4.0.4 
ed20-******.gx.internal.cloudapp.net <--> 10.4.0.8 
hn0-******.gx.internal.cloudapp.net <--> 10.4.0.18 
hn1-******.gx.internal.cloudapp.net <--> 10.4.0.13 
wn0-******.gx.internal.cloudapp.net <--> 10.4.0.7 
zk1-******.gx.internal.cloudapp.net <--> 10.4.0.12 
zk3-******.gx.internal.cloudapp.net <--> 10.4.0.9 
zk5-******.gx.internal.cloudapp.net <--> 10.4.0.10 

아래처럼 스크립트를 실행할 수 있습니다 :

[[email protected] home]# ./deploy.sh <password> <clustername> 
10.4.0.4 
10.4.0.8