Azure HDInsight: Azure CLI 샘플
이 문서에서는 일반적인 작업에 대한 샘플 스크립트를 제공합니다. 각 예제의 경우 적절한 값으로 변수를 업데이트한 다음, 명령을 실행합니다.
필수 조건
Azure CLI 단계는 Azure CLI 설치를 참조하세요.
선택 사항: Bash. 이 문서의 예제에서는 Windows 10의 Bash 셸을 사용합니다. Windows 10을 위한 Linux용 Windows 하위 시스템 설치 가이드에서 설치 단계를 참조하세요. 약간의 수정을 거치면 예제를 Windows 명령 프롬프트에서 작업할 수 있습니다.
az login
Azure에 로그인합니다.
az login
# If you have multiple subscriptions, set the one to use
# az account set --subscription "SUBSCRIPTIONID"
az hdinsight create
기존 스토리지 계정을 사용하여 클러스터 만들기
# set variables
export clusterName=CLUSTERNAME
export resourceGroupName=RESOURCEGROUPNAME
export clusterType=hadoop
export httpCredential='PASSWORD'
export AZURE_STORAGE_ACCOUNT=STORAGEACCOUNTNAME
az hdinsight create \
--name $clusterName \
--resource-group $resourceGroupName \
--type $clusterType \
--http-password $httpCredential \
--storage-account $AZURE_STORAGE_ACCOUNT
ESP(Enterprise Security Package)를 사용하여 클러스터 만들기
export clusterName=CLUSTERNAME
export resourceGroupName=RESOURCEGROUPNAME
export clusterType=spark
export httpCredential='PASSWORD'
export AZURE_STORAGE_ACCOUNT=STORAGEACCOUNTNAME
export subnet="/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/MyRG/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/subnet1"
export domain="/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/MyRG/providers/Microsoft.AAD/domainServices/MyDomain.onmicrosoft.com"
export userAssignedIdentity="/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/MyMsiRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MyMSI"
export domainAccount=MyAdminAccount@MyDomain.onmicrosoft.com
export groupDNS=MyGroup
az hdinsight create \
--esp \
--name $clusterName \
--resource-group $resourceGroupName \
--type $clusterType \
--http-password $httpCredential \
--storage-account $AZURE_STORAGE_ACCOUNT \
--subnet $subnet \
--domain $domain \
--assign-identity $userAssignedIdentity \
--cluster-admin-account $domainAccount \
--cluster-users-group-dns $groupDNS
디스크 암호화를 사용하여 Kafka 클러스터 만들기
export clusterName=CLUSTERNAME
export resourceGroupName=RESOURCEGROUPNAME
export clusterType=kafka
export httpCredential='PASSWORD'
export AZURE_STORAGE_ACCOUNT=STORAGEACCOUNTNAME
export encryptionKeyName=kafkaClusterKey
export encryptionKeyVersion=00000000000000000000000000000000
export encryptionVaultUri=https://MyKeyVault.vault.azure.net
export userAssignedIdentity="/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/MyMsiRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MyMSI"
az hdinsight create \
--name $clusterName \
--resource-group $resourceGroupName \
--type $clusterType \
--http-password $httpCredential \
--storage-account $AZURE_STORAGE_ACCOUNT \
--workernode-data-disks-per-node 2 \
--encryption-key-name $encryptionKeyName \
--encryption-key-version $encryptionKeyVersion \
--encryption-vault-uri $encryptionVaultUri \
--assign-identity $userAssignedIdentity
Azure Data Lake Storage Gen2로 클러스터 만들기
export clusterName=CLUSTERNAME
export resourceGroupName=RESOURCEGROUPNAME
export clusterType=spark
export httpCredential='PASSWORD'
export adlgen2=MyStorageAccount
export sami=MyMSI
az hdinsight create \
--name $clusterName \
--resource-group $resourceGroupName \
--type $clusterType \
--http-password $httpCredential \
--storage-account $adlgen2 \
--storage-account-managed-identity $sami
JSON 문자열의 구성을 사용하여 클러스터 만들기
export clusterName=CLUSTERNAME
export resourceGroupName=RESOURCEGROUPNAME
export clusterType=spark
export httpCredential='PASSWORD'
export AZURE_STORAGE_ACCOUNT=STORAGEACCOUNTNAME
export clusterConfiguration="{'gateway':{'restAuthCredential.username':'admin'}}"
az hdinsight create \
--name $clusterName \
--resource-group $resourceGroupName \
--type $clusterType \
--http-password $httpCredential \
--storage-account $AZURE_STORAGE_ACCOUNT \
--cluster-configuration $clusterConfiguration
로컬 파일의 구성을 사용하여 클러스터 만들기
export clusterName=CLUSTERNAME
export resourceGroupName=RESOURCEGROUPNAME
export clusterType=spark
export httpCredential='PASSWORD'
export AZURE_STORAGE_ACCOUNT=STORAGEACCOUNTNAME
export clusterConfiguration=@/mnt/c/HDI/config.json
az hdinsight create \
--name $clusterName \
--resource-group $resourceGroupName \
--type $clusterType \
--http-password $httpCredential \
--storage-account $AZURE_STORAGE_ACCOUNT \
--cluster-configuration $clusterConfiguration
az hdinsight application create
스크립트 URI를 사용하여 애플리케이션 만들기
export resourceGroupName=RESOURCEGROUPNAME
export applicationName=MyApplication
export clusterName=CLUSTERNAME
export scriptURI=https://hdiconfigactions.blob.core.windows.net/linuxhueconfigactionv02/install-hue-uber-v02.sh
export scriptActionName=MyScriptAction
export scriptParameters='"-version latest -port 20000"'
az hdinsight application create \
--resource-group $resourceGroupName \
--name $applicationName \
--cluster-name $clusterName \
--script-uri $scriptURI \
--script-action-name $scriptActionName \
--script-parameters "$scriptParameters"
스크립트 URI 및 지정된 에지 노드 크기를 사용하여 애플리케이션 만들기
export resourceGroupName=RESOURCEGROUPNAME
export applicationName=MyApplication
export clusterName=CLUSTERNAME
export scriptURI=https://hdiconfigactions.blob.core.windows.net/linuxhueconfigactionv02/install-hue-uber-v02.sh
export scriptActionName=MyScriptAction
export scriptParameters='"-version latest -port 20000"'
export edgenodeSize=Standard_D4_v2
az hdinsight application create \
--resource-group $resourceGroupName \
--name $applicationName \
--cluster-name $clusterName \
--script-uri $scriptURI \
--script-action-name $scriptActionName \
--script-parameters "$scriptParameters" \
--edgenode-size $edgenodeSize
HTTPS 엔드포인트를 사용하여 애플리케이션 만들기
export resourceGroupName=RESOURCEGROUPNAME
export applicationName=MyApplication
export clusterName=CLUSTERNAME
export scriptURI=https://hdiconfigactions.blob.core.windows.net/linuxhueconfigactionv02/install-hue-uber-v02.sh
export scriptActionName=MyScriptAction
export scriptParameters='"-version latest -port 20000"'
export destinationPort=8888
export subDomainSuffix=was
az hdinsight application create \
--resource-group $resourceGroupName \
--name $applicationName \
--cluster-name $clusterName \
--script-uri $scriptURI \
--script-action-name $scriptActionName \
--script-parameters "$scriptParameters" \
--destination-port $destinationPort \
--sub-domain-suffix $subDomainSuffix
az hdinsight script-action execute
지정된 HDInsight 클러스터에서 스크립트 동작을 실행합니다.
스크립트 동작 실행 및 성공 시 지속
export resourceGroupName=RESOURCEGROUPNAME
export clusterName=CLUSTERNAME
export scriptActionName=MyScriptAction
export scriptURI=https://hdiconfigactions.blob.core.windows.net/linuxgiraphconfigactionv01/giraph-installer-v01.sh
export roles="headnode workernode"
az hdinsight script-action execute \
--resource-group $resourceGroupName \
--cluster-name $clusterName \
--name $scriptActionName \
--script-uri $scriptURI \
--roles $roles \
--persist-on-success