title | description | ms.service | ms.topic | ms.custom | ms.date |
---|---|---|---|---|---|
Manage Azure HDInsight clusters using Azure CLI |
Learn how to use the Azure CLI to manage Azure HDInsight clusters. Cluster types include Apache Hadoop, Spark, HBase, Kafka, Interactive Query. |
azure-hdinsight |
conceptual |
hdinsightactive, devx-track-azurecli |
12/05/2023 |
[!INCLUDE selector]
Learn how to use Azure CLI to manage Azure HDInsight clusters. The Azure CLI is Microsoft's cross-platform command-line experience for managing Azure resources.
If you don't have an Azure subscription, create a free account before you begin.
-
Azure CLI. If you haven't installed the Azure CLI, see Install the Azure CLI for steps.
-
An Apache Hadoop cluster on HDInsight. See Get Started with HDInsight on Linux.
Sign in to your Azure subscription. If you plan to use Azure Cloud Shell, then select Try it in the upper-right corner of the code block. Else, enter the following command:
az login
# If you have multiple subscriptions, set the one to use
# az account set --subscription "SUBSCRIPTIONID"
Use az HDInsight list to list clusters. Edit the following commands by replacing RESOURCE_GROUP_NAME
with the name of your resource group, then enter the commands:
# List all clusters in the current subscription
az hdinsight list
# List only cluster name and its resource group
az hdinsight list --query "[].{Cluster:name, ResourceGroup:resourceGroup}" --output table
# List all cluster for your resource group
az hdinsight list --resource-group RESOURCE_GROUP_NAME
# List all cluster names for your resource group
az hdinsight list --resource-group RESOURCE_GROUP_NAME --query "[].{clusterName:name}" --output table
Use az HDInsight show to show information for a specified cluster. Edit the following command by replacing RESOURCE_GROUP_NAME
, and CLUSTER_NAME
with the relevant information, then enter the command:
az hdinsight show --resource-group RESOURCE_GROUP_NAME --name CLUSTER_NAME
Use az HDInsight delete to delete a specified cluster. Edit the following command by replacing RESOURCE_GROUP_NAME
, and CLUSTER_NAME
with the relevant information, then enter the command:
az hdinsight delete --resource-group RESOURCE_GROUP_NAME --name CLUSTER_NAME
You can also delete a cluster by deleting the resource group that contains the cluster. Note, this deletes all the resources in the group including the default storage account.
az group delete --name RESOURCE_GROUP_NAME
Use az HDInsight resize to resize the specified HDInsight cluster to the specified size. Edit the following command by replacing RESOURCE_GROUP_NAME
, and CLUSTER_NAME
with the relevant information. Replace WORKERNODE_COUNT
with the desired number of worker nodes for your cluster. For more information about scaling clusters, see Scale HDInsight clusters. Enter the command:
az hdinsight resize --resource-group RESOURCE_GROUP_NAME --name CLUSTER_NAME --workernode-count WORKERNODE_COUNT
In this article, you've learned how to perform different HDInsight cluster administrative tasks. To learn more, see the following articles: