Ambari Rest API uses

Source: Internet
Author: User

Recently, as a result of the project's need to look at some Ambari API to get some information about the cluster, get the status information of the cluster nodes and the information of each service and component. Then in our data service management platform to do some monitoring operations, now to summarize some of the use:
Website REST API Address:
https://cwiki.apache.org/confluence/display/AMBARI/
The Ambari API makes it easier to manage and monitor Hadoop cluster resources. The documentation describes the resources and syntax of the Ambari API to make it easier for developers to join Ambari.
(1) Certification and authorization
The Ambari API you perform requires authentication. The proximity API requires Basic authentication. In order to use Basic authentication, you need to send a request with a "authorization:base" header. For example, you can send this when you use the Curl command:

 curl–user name:password http:// { Your.ambari.server}/api/v1/clusters  

Note: The authentication method and the resource configuration are on the Ambari server side. The method of modifying or configuring authentication is not included in this document.
(2) Monitoring
Ambari APID provides metric information for monitoring and managing the resources of a Hadoop cluster.
"1" Get
The Get method allows you to read information about the properties, metrics, and subordinate resources of the Amabari resource. Calling the Get method to return a request resource does not cause side effects. A return value of 200 indicates that the request was successfully returned and contains the response content
For example, get the information for the component Datanode of the HDFs service for the cluster "C1":

< Span class= "Apple-converted-space" >< Span class= "Apple-converted-space" >< Span class= "Apple-converted-space" >< Span class= "Apple-converted-space" > (3) management &NBSP; the
Amabri API contains management of the Hadoop cluster resources. Includes create, delete, and resource upgrades. &NBSP;
"1" post&NBSP;
You can create a new resource by using the Post method. If the new resource is created, the return value is 201. A return value of 202 indicates that the request has been accepted by the server. &NBSP;
For example: Create HDFs service &NBSP;

 Post/clusters/c1/services/hdfs 

"2" Put  
Use the Put method to update resources. If the existing resource is modified, the return value of 200 indicates that the request completed successfully. A request value of 202 also indicates that the server accepted the request. &NBSP;
For example: Start HDFs Service (update HDFs status to ' started ') &NBSP;

 put/clusters/c1/services/hdfs/

"3" delete &NBSP;
Use the Delete method to delete a resource. If the existing cluster is deleted, the return value of 200 indicates that the request completed successfully. A return value of 202 also indicates that the server accepted the directive and that the resource was marked for deletion. &NBSP;
For example: Remove clusters with the cluster name "C1": &NBSP;

 DELETE/CLUSTERS/C1 

asynchronous response &NBSP;
The management API returns a return value of 202 that indicates that the request was accepted. The response contains the request ID and the href that carries the request command. &NBSP;
the href in the response can be used to query the resource associated with the request and the process that monitors the request. The request resource contains one or more child task resources. The following example shows how to use a partial response to query a request resource. &NBSP;

/clusters/c1/requests/6? fields=tasks/tasks/*

(4) Resources
"1" Resource acquisition
Resource acquisition is a combination of resources of the same type, not a specific resource. For example:
/clusters, emphasizing the collection of clusters.
"2" resource instance
A resource instance is a single specific resource. For example:
/CLUSTERS/C1, emphasizing cluster resources with ID ' C1 '
"3" type
The type of the resource that is divided by the group. A resource that allows a user to query the type of line communication. Individual resource types contain subtypes (for example, a service is a sub-resource of a cluster)
The following is a description of the Ambari resource type and the use case.
[1] Cluster
Cluster resources represent the name of the Hadoop cluster. Clusters are the highest level of resources
Cluster Resources
[2] Service
Service resources when Hadoop cluster services (for example, Hdfs/mapduce/ganglia). Service resources are sub-resources of the cluster

Ambari Rest API uses

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.