You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Learn how to use the Apache Ambari REST API to manage and monitor Apache Hadoop clusters in Azure HDInsight.
19
19
20
20
## <aid="whatis"></a>What is Apache Ambari
21
+
21
22
[Apache Ambari](https://ambari.apache.org) simplifies the management and monitoring of Hadoop clusters by providing an easy to use web UI backed by its [REST APIs](https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md). Ambari is provided by default with Linux-based HDInsight clusters.
22
23
23
24
## Prerequisites
25
+
24
26
***A Hadoop cluster on HDInsight**. See [Get Started with HDInsight on Linux](hadoop/apache-hadoop-linux-tutorial-get-started.md).
25
27
26
28
***Bash on Ubuntu on Windows 10**. The examples in this article use the Bash shell on Windows 10. See [Windows Subsystem for Linux Installation Guide for Windows 10](https://docs.microsoft.com/windows/wsl/install-win10) for installation steps. Other [Unix shells](https://www.gnu.org/software/bash/) will work as well. The examples, with some slight modifications, can work on a Windows Command prompt. Alternatively, you can use Windows PowerShell.
@@ -31,7 +33,7 @@ Learn how to use the Apache Ambari REST API to manage and monitor Apache Hadoop
31
33
32
34
## Base URI for Ambari Rest API
33
35
34
-
The base URI for the Ambari REST API on HDInsight is `https://CLUSTERNAME.azurehdinsight.net/api/v1/clusters/CLUSTERNAME`, where `CLUSTERNAME` is the name of your cluster. Cluster names in URIs are **case-sensitive**. While the cluster name in the fully qualified domain name (FQDN) part of the URI (CLUSTERNAME.azurehdinsight.net) is case-insensitive, other occurrences in the URI are case-sensitive.
36
+
The base Uniform Resource Identifier (URI) for the Ambari REST API on HDInsight is `https://CLUSTERNAME.azurehdinsight.net/api/v1/clusters/CLUSTERNAME`, where `CLUSTERNAME` is the name of your cluster. Cluster names in URIs are **case-sensitive**. While the cluster name in the fully qualified domain name (FQDN) part of the URI (`CLUSTERNAME.azurehdinsight.net`) is case-insensitive, other occurrences in the URI are case-sensitive.
The actual casing of the cluster name may be different than you expect depending on how the cluster was created. The steps here will show the actual casing, and then store it in a variable for all subsequent examples.
61
+
The actual casing of the cluster name may be different than you expect, depending on how the cluster was created. The steps here will show the actual casing, and then store it in a variable for all subsequent examples.
60
62
61
63
Edit the scripts below to replace `CLUSTERNAME` with your cluster name. Then enter the command. (The cluster name for the FQDN is not case-sensitive.)
The return value is similar to one of the following examples:
208
208
209
-
*`wasb://[email protected]` - This value indicates that the cluster is using an Azure Storage account for default storage. The `ACCOUNTNAME` value is the name of the storage account. The `CONTAINER` portion is the name of the blob container in the storage account. The container is the root of the HDFS compatible storage for the cluster.
209
+
*`wasbs://[email protected]` - This value indicates that the cluster is using an Azure Storage account for default storage. The `ACCOUNTNAME` value is the name of the storage account. The `CONTAINER` portion is the name of the blob container in the storage account. The container is the root of the HDFS compatible storage for the cluster.
210
210
211
211
*`abfs://[email protected]` - This value indicates that the cluster is using Azure Data Lake Storage Gen2 for default storage. The `ACCOUNTNAME` and `CONTAINER` values have the same meanings as for Azure Storage mentioned previously.
212
212
@@ -216,7 +216,7 @@ The return value is similar to one of the following examples:
@@ -247,7 +247,6 @@ The return value is similar to one of the following examples:
247
247
> [!NOTE]
248
248
> The [Get-AzHDInsightCluster](https://docs.microsoft.com/powershell/module/az.hdinsight/get-azhdinsightcluster) cmdlet provided by [Azure PowerShell](/powershell/azure/overview) also returns the storage information for the cluster.
249
249
250
-
251
250
### <a name="get-all-configurations"></a> Get all configurations
252
251
253
252
Get the configurations that are available for your cluster.
@@ -263,7 +262,7 @@ $respObj.Content
263
262
```
264
263
265
264
This example returns a JSON document containing the current configuration (identified by the *tag* value) for the components installed on the cluster. The following example is an excerpt from the data returned from a Spark cluster type.
266
-
265
+
267
266
```json
268
267
"jupyter-site": {
269
268
"tag":"INITIAL",
@@ -307,10 +306,9 @@ This example returns a JSON document containing the current configuration for th
The PowerShell script uses [jq](https://stedolan.github.io/jq/). Edit `C:\HD\jq\jq-win64` below to reflect your actual path and version of [jq](https://stedolan.github.io/jq/).
315
313
316
314
```powershell
@@ -398,7 +396,6 @@ At this point, if you look at the Ambari web UI, the Spark service indicates tha
398
396
-Method PUT `
399
397
-Headers @{"X-Requested-By" = "ambari"} `
400
398
-Body '{"RequestInfo": {"context": "turning on maintenance mode for SPARK2"},"Body": {"ServiceInfo": {"maintenance_state":"ON"}}}'
401
-
$resp.Content
402
399
```
403
400
404
401
2. Verify maintenance mode
@@ -424,16 +421,16 @@ At this point, if you look at the Ambari web UI, the Spark service indicates tha
-X PUT -d '{"RequestInfo":{"context":"_PARSE_.STOP.SPARK","operation_level":{"level":"SERVICE","cluster_name":"CLUSTERNAME","service_name":"SPARK"}},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' \
-X PUT -d '{"RequestInfo":{"context":"_PARSE_.STOP.SPARK2","operation_level":{"level":"SERVICE","cluster_name":"CLUSTERNAME","service_name":"SPARK"}},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' \
@@ -450,7 +447,7 @@ At this point, if you look at the Ambari web UI, the Spark service indicates tha
450
447
```
451
448
452
449
> [!IMPORTANT]
453
-
> The `href` value returned by this URI is using the internal IP address of the cluster node. To use it from outside the cluster, replace the `10.0.0.18:8080' portion with the FQDN of the cluster.
450
+
> The `href` value returned by this URI is using the internal IP address of the cluster node. To use it from outside the cluster, replace the `10.0.0.18:8080` portion with the FQDN of the cluster.
454
451
455
452
4. Verify request.
456
453
Edit the command below by replacing `29` with the actual value for `id` returned from the prior step. The following commands retrieve the status of the request:
@@ -471,10 +468,10 @@ At this point, if you look at the Ambari web UI, the Spark service indicates tha
471
468
A response of `COMPLETED` indicates that the request has finished.
472
469
473
470
5. Once the previous request completes, use the following to start the Spark2 service.
-X PUT -d '{"RequestInfo":{"context":"_PARSE_.STOP.SPARK","operation_level":{"level":"SERVICE","cluster_name":"CLUSTERNAME","service_name":"SPARK"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' \
474
+
-X PUT -d '{"RequestInfo":{"context":"_PARSE_.START.SPARK2","operation_level":{"level":"SERVICE","cluster_name":"CLUSTERNAME","service_name":"SPARK"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' \
@@ -502,10 +500,8 @@ At this point, if you look at the Ambari web UI, the Spark service indicates tha
502
500
-Method PUT `
503
501
-Headers @{"X-Requested-By" = "ambari"} `
504
502
-Body '{"RequestInfo": {"context": "turning off maintenance mode for SPARK2"},"Body": {"ServiceInfo": {"maintenance_state":"OFF"}}}'
505
-
506
503
```
507
504
508
505
## Next steps
509
506
510
-
For a complete reference of the REST API, see [Apache Ambari API Reference V1](https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md).
511
-
507
+
For a complete reference of the REST API, see [Apache Ambari API Reference V1](https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md).
0 commit comments