hadoop/hadoop-yarn/hadoop-yarn-site/WebServicesIntro.html

1133 lines
51 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
| Generated by Apache Maven Doxia at 2023-02-14
| Rendered using Apache Maven Stylus Skin 1.5
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Apache Hadoop 3.4.0-SNAPSHOT &#x2013; Hadoop YARN - Introduction to the web services REST APIs</title>
<style type="text/css" media="all">
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/site.css");
</style>
<link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
<meta name="Date-Revision-yyyymmdd" content="20230214" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body class="composite">
<div id="banner">
<a href="http://hadoop.apache.org/" id="bannerLeft">
<img src="http://hadoop.apache.org/images/hadoop-logo.jpg" alt="" />
</a>
<a href="http://www.apache.org/" id="bannerRight">
<img src="http://www.apache.org/images/asf_logo_wide.png" alt="" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xright"> <a href="http://wiki.apache.org/hadoop" class="externalLink">Wiki</a>
|
<a href="https://gitbox.apache.org/repos/asf/hadoop.git" class="externalLink">git</a>
|
<a href="http://hadoop.apache.org/" class="externalLink">Apache Hadoop</a>
&nbsp;| Last Published: 2023-02-14
&nbsp;| Version: 3.4.0-SNAPSHOT
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>General</h5>
<ul>
<li class="none">
<a href="../../index.html">Overview</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/SingleCluster.html">Single Node Setup</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/ClusterSetup.html">Cluster Setup</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/CommandsManual.html">Commands Reference</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/FileSystemShell.html">FileSystem Shell</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Compatibility.html">Compatibility Specification</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/DownstreamDev.html">Downstream Developer's Guide</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/AdminCompatibilityGuide.html">Admin Compatibility Guide</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/InterfaceClassification.html">Interface Classification</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/filesystem/index.html">FileSystem Specification</a>
</li>
</ul>
<h5>Common</h5>
<ul>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/CLIMiniCluster.html">CLI Mini Cluster</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/FairCallQueue.html">Fair Call Queue</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/NativeLibraries.html">Native Libraries</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Superusers.html">Proxy User</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/RackAwareness.html">Rack Awareness</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/SecureMode.html">Secure Mode</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/ServiceLevelAuth.html">Service Level Authorization</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/HttpAuthentication.html">HTTP Authentication</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/CredentialProviderAPI.html">Credential Provider API</a>
</li>
<li class="none">
<a href="../../hadoop-kms/index.html">Hadoop KMS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Tracing.html">Tracing</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/UnixShellGuide.html">Unix Shell Guide</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/registry/index.html">Registry</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/AsyncProfilerServlet.html">Async Profiler</a>
</li>
</ul>
<h5>HDFS</h5>
<ul>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsDesign.html">Architecture</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsUserGuide.html">User Guide</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSCommands.html">Commands Reference</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html">NameNode HA With QJM</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithNFS.html">NameNode HA With NFS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ObserverNameNode.html">Observer NameNode</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/Federation.html">Federation</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ViewFs.html">ViewFs</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ViewFsOverloadScheme.html">ViewFsOverloadScheme</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsSnapshots.html">Snapshots</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsEditsViewer.html">Edits Viewer</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsImageViewer.html">Image Viewer</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html">Permissions and HDFS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsQuotaAdminGuide.html">Quotas and HDFS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/LibHdfs.html">libhdfs (C API)</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/WebHDFS.html">WebHDFS (REST API)</a>
</li>
<li class="none">
<a href="../../hadoop-hdfs-httpfs/index.html">HttpFS</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ShortCircuitLocalReads.html">Short Circuit Local Reads</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/CentralizedCacheManagement.html">Centralized Cache Management</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsNfsGateway.html">NFS Gateway</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsRollingUpgrade.html">Rolling Upgrade</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ExtendedAttributes.html">Extended Attributes</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/TransparentEncryption.html">Transparent Encryption</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsMultihoming.html">Multihoming</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/ArchivalStorage.html">Storage Policies</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/MemoryStorage.html">Memory Storage Support</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/SLGUserGuide.html">Synthetic Load Generator</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSErasureCoding.html">Erasure Coding</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HDFSDiskbalancer.html">Disk Balancer</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsUpgradeDomain.html">Upgrade Domain</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsDataNodeAdminGuide.html">DataNode Admin</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs-rbf/HDFSRouterFederation.html">Router Federation</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/HdfsProvidedStorage.html">Provided Storage</a>
</li>
</ul>
<h5>MapReduce</h5>
<ul>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html">Tutorial</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapredCommands.html">Commands Reference</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduce_Compatibility_Hadoop1_Hadoop2.html">Compatibility with 1.x</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/EncryptedShuffle.html">Encrypted Shuffle</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/PluggableShuffleAndPluggableSort.html">Pluggable Shuffle/Sort</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/DistributedCacheDeploy.html">Distributed Cache Deploy</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/SharedCacheSupport.html">Support for YARN Shared Cache</a>
</li>
</ul>
<h5>MapReduce REST APIs</h5>
<ul>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapredAppMasterRest.html">MR Application Master</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-hs/HistoryServerRest.html">MR History Server</a>
</li>
</ul>
<h5>YARN</h5>
<ul>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/YARN.html">Architecture</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/YarnCommands.html">Commands Reference</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/CapacityScheduler.html">Capacity Scheduler</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/FairScheduler.html">Fair Scheduler</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerRestart.html">ResourceManager Restart</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerHA.html">ResourceManager HA</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ResourceModel.html">Resource Model</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeLabel.html">Node Labels</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeAttributes.html">Node Attributes</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/WebApplicationProxy.html">Web Application Proxy</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServer.html">Timeline Server</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServiceV2.html">Timeline Service V.2</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/WritingYarnApplications.html">Writing YARN Applications</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/YarnApplicationSecurity.html">YARN Application Security</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeManager.html">NodeManager</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/DockerContainers.html">Running Applications in Docker Containers</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/RuncContainers.html">Running Applications in runC Containers</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeManagerCgroups.html">Using CGroups</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/SecureContainer.html">Secure Containers</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ReservationSystem.html">Reservation System</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/GracefulDecommission.html">Graceful Decommission</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/OpportunisticContainers.html">Opportunistic Containers</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/Federation.html">YARN Federation</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/SharedCache.html">Shared Cache</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/UsingGpus.html">Using GPU</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/UsingFPGA.html">Using FPGA</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/PlacementConstraints.html">Placement Constraints</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/YarnUI2.html">YARN UI2</a>
</li>
</ul>
<h5>YARN REST APIs</h5>
<ul>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/WebServicesIntro.html">Introduction</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html">Resource Manager</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/NodeManagerRest.html">Node Manager</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServer.html#Timeline_Server_REST_API_v1">Timeline Server</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/TimelineServiceV2.html#Timeline_Service_v.2_REST_API">Timeline Service V.2</a>
</li>
</ul>
<h5>YARN Service</h5>
<ul>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/Overview.html">Overview</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/QuickStart.html">QuickStart</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/Concepts.html">Concepts</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/YarnServiceAPI.html">Yarn Service API</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/ServiceDiscovery.html">Service Discovery</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-site/yarn-service/SystemServices.html">System Services</a>
</li>
</ul>
<h5>Hadoop Compatible File Systems</h5>
<ul>
<li class="none">
<a href="../../hadoop-aliyun/tools/hadoop-aliyun/index.html">Aliyun OSS</a>
</li>
<li class="none">
<a href="../../hadoop-aws/tools/hadoop-aws/index.html">Amazon S3</a>
</li>
<li class="none">
<a href="../../hadoop-azure/index.html">Azure Blob Storage</a>
</li>
<li class="none">
<a href="../../hadoop-azure-datalake/index.html">Azure Data Lake Storage</a>
</li>
<li class="none">
<a href="../../hadoop-cos/cloud-storage/index.html">Tencent COS</a>
</li>
<li class="none">
<a href="../../hadoop-huaweicloud/cloud-storage/index.html">Huaweicloud OBS</a>
</li>
</ul>
<h5>Auth</h5>
<ul>
<li class="none">
<a href="../../hadoop-auth/index.html">Overview</a>
</li>
<li class="none">
<a href="../../hadoop-auth/Examples.html">Examples</a>
</li>
<li class="none">
<a href="../../hadoop-auth/Configuration.html">Configuration</a>
</li>
<li class="none">
<a href="../../hadoop-auth/BuildingIt.html">Building</a>
</li>
</ul>
<h5>Tools</h5>
<ul>
<li class="none">
<a href="../../hadoop-streaming/HadoopStreaming.html">Hadoop Streaming</a>
</li>
<li class="none">
<a href="../../hadoop-archives/HadoopArchives.html">Hadoop Archives</a>
</li>
<li class="none">
<a href="../../hadoop-archive-logs/HadoopArchiveLogs.html">Hadoop Archive Logs</a>
</li>
<li class="none">
<a href="../../hadoop-distcp/DistCp.html">DistCp</a>
</li>
<li class="none">
<a href="../../hadoop-federation-balance/HDFSFederationBalance.html">HDFS Federation Balance</a>
</li>
<li class="none">
<a href="../../hadoop-gridmix/GridMix.html">GridMix</a>
</li>
<li class="none">
<a href="../../hadoop-rumen/Rumen.html">Rumen</a>
</li>
<li class="none">
<a href="../../hadoop-resourceestimator/ResourceEstimator.html">Resource Estimator Service</a>
</li>
<li class="none">
<a href="../../hadoop-sls/SchedulerLoadSimulator.html">Scheduler Load Simulator</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Benchmarking.html">Hadoop Benchmarking</a>
</li>
<li class="none">
<a href="../../hadoop-dynamometer/Dynamometer.html">Dynamometer</a>
</li>
</ul>
<h5>Reference</h5>
<ul>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/release/">Changelog and Release Notes</a>
</li>
<li class="none">
<a href="../../api/index.html">Java API docs</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/UnixShellAPI.html">Unix Shell API</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/Metrics.html">Metrics</a>
</li>
</ul>
<h5>Configuration</h5>
<ul>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/core-default.xml">core-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs/hdfs-default.xml">hdfs-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-hdfs-rbf/hdfs-rbf-default.xml">hdfs-rbf-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml">mapred-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-yarn/hadoop-yarn-common/yarn-default.xml">yarn-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-kms/kms-default.html">kms-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-hdfs-httpfs/httpfs-default.html">httpfs-default.xml</a>
</li>
<li class="none">
<a href="../../hadoop-project-dist/hadoop-common/DeprecatedProperties.html">Deprecated Properties</a>
</li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img alt="Built by Maven" src="./images/logos/maven-feather.png"/>
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<!---
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<h1>Hadoop YARN - Introduction to the web services REST API&#x2019;s</h1>
<ul>
<li><a href="#Overview">Overview</a></li>
<li><a href="#URI.E2.80.99s">URI&#x2019;s</a></li>
<li><a href="#HTTP_Requests">HTTP Requests</a>
<ul>
<li><a href="#Summary_of_HTTP_operations">Summary of HTTP operations</a></li>
<li><a href="#Security">Security</a></li>
<li><a href="#Headers_Supported">Headers Supported</a></li></ul></li>
<li><a href="#HTTP_Responses">HTTP Responses</a>
<ul>
<li><a href="#Compression">Compression</a></li>
<li><a href="#Response_Formats">Response Formats</a></li>
<li><a href="#Response_Errors">Response Errors</a></li>
<li><a href="#Response_Examples">Response Examples</a></li></ul></li>
<li><a href="#Sample_Usage">Sample Usage</a></li></ul>
<section>
<h2><a name="Overview"></a>Overview</h2>
<p>The Hadoop YARN web service REST APIs are a set of URI resources that give access to the cluster, nodes, applications, and application historical information. The URI resources are grouped into APIs based on the type of information returned. Some URI resources return collections while others return singletons.</p></section><section>
<h2><a name="URI.E2.80.99s"></a>URI&#x2019;s</h2>
<p>The URIs for the REST-based Web services have the following syntax:</p>
<div class="source">
<div class="source">
<pre> http://{http address of service}/ws/{version}/{resourcepath}
</pre></div></div>
<p>The elements in this syntax are as follows:</p>
<div class="source">
<div class="source">
<pre> {http address of service} - The http address of the service to get information about.
Currently supported are the ResourceManager, NodeManager,
MapReduce application master, and history server.
{version} - The version of the APIs. In this release, the version is v1.
{resourcepath} - A path that defines a singleton resource or a collection of resources.
</pre></div></div>
</section><section>
<h2><a name="HTTP_Requests"></a>HTTP Requests</h2>
<p>To invoke a REST API, your application calls an HTTP operation on the URI associated with a resource.</p><section>
<h3><a name="Summary_of_HTTP_operations"></a>Summary of HTTP operations</h3>
<p>Currently only GET is supported. It retrieves information about the resource specified.</p></section><section>
<h3><a name="Security"></a>Security</h3>
<p>The web service REST API&#x2019;s go through the same security as the web UI. If your cluster adminstrators have filters enabled you must authenticate via the mechanism they specified.</p></section><section>
<h3><a name="Headers_Supported"></a>Headers Supported</h3>
<ul>
<li>Accept
<ul>
<li>Accept-Encoding</li>
</ul>
</li>
</ul>
<p>Currently the only fields used in the header is <code>Accept</code> and <code>Accept-Encoding</code>. <code>Accept</code> currently supports XML and JSON for the response type you accept. <code>Accept-Encoding</code> currently supports only gzip format and will return gzip compressed output if this is specified, otherwise output is uncompressed. All other header fields are ignored.</p></section></section><section>
<h2><a name="HTTP_Responses"></a>HTTP Responses</h2>
<p>The next few sections describe some of the syntax and other details of the HTTP Responses of the web service REST APIs.</p><section>
<h3><a name="Compression"></a>Compression</h3>
<p>This release supports gzip compression if you specify gzip in the Accept-Encoding header of the HTTP request (Accept-Encoding: gzip).</p></section><section>
<h3><a name="Response_Formats"></a>Response Formats</h3>
<p>This release of the web service REST APIs supports responses in JSON and XML formats. JSON is the default. To set the response format, you can specify the format in the Accept header of the HTTP request.</p>
<p>As specified in HTTP Response Codes, the response body can contain the data that represents the resource or an error message. In the case of success, the response body is in the selected format, either JSON or XML. In the case of error, the resonse body is in either JSON or XML based on the format requested. The Content-Type header of the response contains the format requested. If the application requests an unsupported format, the response status code is 500. Note that the order of the fields within response body is not specified and might change. Also, additional fields might be added to a response body. Therefore, your applications should use parsing routines that can extract data from a response body in any order.</p></section><section>
<h3><a name="Response_Errors"></a>Response Errors</h3>
<p>After calling an HTTP request, an application should check the response status code to verify success or detect an error. If the response status code indicates an error, the response body contains an error message. The first field is the exception type, currently only RemoteException is returned. The following table lists the items within the RemoteException error message:</p>
<table border="0" class="bodyTable">
<thead>
<tr class="a">
<th align="left"> Item </th>
<th align="left"> Data Type </th>
<th align="left"> Description </th></tr>
</thead><tbody>
<tr class="b">
<td align="left"> exception </td>
<td align="left"> String </td>
<td align="left"> Exception type </td></tr>
<tr class="a">
<td align="left"> javaClassName </td>
<td align="left"> String </td>
<td align="left"> Java class name of exception </td></tr>
<tr class="b">
<td align="left"> message </td>
<td align="left"> String </td>
<td align="left"> Detailed message of exception </td></tr>
</tbody>
</table></section><section>
<h3><a name="Response_Examples"></a>Response Examples</h3><section>
<h4><a name="JSON_response_with_single_resource"></a>JSON response with single resource</h4>
<p>_1324057493980_0001HTTP Request: GET <a class="externalLink" href="http://rmhost.domain:8088/ws/v1/cluster/apps/application">http://rmhost.domain:8088/ws/v1/cluster/apps/application</a></p>
<p>Response Status Line: HTTP/1.1 200 OK</p>
<p>Response Header:</p>
<div class="source">
<div class="source">
<pre> HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Server: Jetty(6.1.26)
</pre></div></div>
<p>Response Body:</p>
<div class="source">
<div class="source">
<pre>{
app&quot;:
{
&quot;id&quot;:&quot;application_1324057493980_0001&quot;,
&quot;user&quot;:&quot;user1&quot;,
&quot;name&quot;:&quot;&quot;,
&quot;queue&quot;:&quot;default&quot;,
&quot;state&quot;:&quot;ACCEPTED&quot;,
&quot;finalStatus&quot;:&quot;UNDEFINED&quot;,
&quot;progress&quot;:0,
&quot;trackingUI&quot;:&quot;UNASSIGNED&quot;,
&quot;diagnostics&quot;:&quot;&quot;,
&quot;clusterId&quot;:1324057493980,
&quot;startedTime&quot;:1324057495921,
&quot;finishedTime&quot;:0,
&quot;elapsedTime&quot;:2063,
&quot;amContainerLogs&quot;:&quot;http:\/\/amNM:2\/node\/containerlogs\/container_1324057493980_0001_01_000001&quot;,
&quot;amHostHttpAddress&quot;:&quot;amNM:2&quot;
}
}
</pre></div></div>
</section><section>
<h4><a name="JSON_response_with_Error_response"></a>JSON response with Error response</h4>
<p>Here we request information about an application that doesn&#x2019;t exist yet.</p>
<p>_1324057493980_9999HTTP Request: GET <a class="externalLink" href="http://rmhost.domain:8088/ws/v1/cluster/apps/application">http://rmhost.domain:8088/ws/v1/cluster/apps/application</a></p>
<p>Response Status Line: HTTP/1.1 404 Not Found</p>
<p>Response Header:</p>
<div class="source">
<div class="source">
<pre> HTTP/1.1 404 Not Found
Content-Type: application/json
Transfer-Encoding: chunked
Server: Jetty(6.1.26)
</pre></div></div>
<p>Response Body:</p>
<div class="source">
<div class="source">
<pre>{
&quot;RemoteException&quot; : {
&quot;javaClassName&quot; : &quot;org.apache.hadoop.yarn.webapp.NotFoundException&quot;,
&quot;exception&quot; : &quot;NotFoundException&quot;,
&quot;message&quot; : &quot;java.lang.Exception: app with id: application_1324057493980_9999 not found&quot;
}
}
</pre></div></div>
</section></section></section><section>
<h2><a name="Sample_Usage"></a>Sample Usage</h2>
<p>You can use any number of ways/languages to use the web services REST API&#x2019;s. This example uses the curl command line interface to do the REST GET calls.</p>
<p>In this example, a user submits a MapReduce application to the ResourceManager using a command like:</p>
<div class="source">
<div class="source">
<pre> hadoop jar hadoop-mapreduce-test.jar sleep -Dmapred.job.queue.name=a1 -m 1 -r 1 -rt 1200000 -mt 20
</pre></div></div>
<p>The client prints information about the job submitted along with the application id, similar to:</p>
<div class="source">
<div class="source">
<pre>12/01/18 04:25:15 INFO mapred.ResourceMgrDelegate: Submitted application application_1326821518301_0010 to ResourceManager at host.domain.com/10.10.10.10:8032
12/01/18 04:25:15 INFO mapreduce.Job: Running job: job_1326821518301_0010
12/01/18 04:25:21 INFO mapred.ClientServiceDelegate: The url to track the job: host.domain.com:8088/proxy/application_1326821518301_0010/
12/01/18 04:25:22 INFO mapreduce.Job: Job job_1326821518301_0010 running in uber mode : false
12/01/18 04:25:22 INFO mapreduce.Job: map 0% reduce 0%
</pre></div></div>
<p>The user then wishes to track the application. The users starts by getting the information about the application from the ResourceManager. Use the &#x2013;comopressed option to request output compressed. curl handles uncompressing on client side.</p>
<div class="source">
<div class="source">
<pre>curl --compressed -H &quot;Accept: application/json&quot; -X GET &quot;http://host.domain.com:8088/ws/v1/cluster/apps/application_1326821518301_0010&quot;
</pre></div></div>
<p>Output:</p>
<div class="source">
<div class="source">
<pre>{
&quot;app&quot; : {
&quot;finishedTime&quot; : 0,
&quot;amContainerLogs&quot; : &quot;http://host.domain.com:8042/node/containerlogs/container_1326821518301_0010_01_000001&quot;,
&quot;trackingUI&quot; : &quot;ApplicationMaster&quot;,
&quot;state&quot; : &quot;RUNNING&quot;,
&quot;user&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;application_1326821518301_0010&quot;,
&quot;clusterId&quot; : 1326821518301,
&quot;finalStatus&quot; : &quot;UNDEFINED&quot;,
&quot;amHostHttpAddress&quot; : &quot;host.domain.com:8042&quot;,
&quot;progress&quot; : 82.44703,
&quot;name&quot; : &quot;Sleep job&quot;,
&quot;startedTime&quot; : 1326860715335,
&quot;elapsedTime&quot; : 31814,
&quot;diagnostics&quot; : &quot;&quot;,
&quot;trackingUrl&quot; : &quot;http://host.domain.com:8088/proxy/application_1326821518301_0010/&quot;,
&quot;queue&quot; : &quot;a1&quot;
}
}
</pre></div></div>
<p>_1326821518301_0010. This could either go to the web browser or use the web service REST APIThe user then wishes to get more details about the running application and goes directly to the MapReduce application master for this application. The ResourceManager lists the trackingUrl that can be used for this application: <a class="externalLink" href="http://host.domain.com:8088/proxy/application">http://host.domain.com:8088/proxy/application</a>&#x2019;s. The user uses the web services REST API&#x2019;s to get the list of jobs this MapReduce application master is running:</p>
<div class="source">
<div class="source">
<pre> curl --compressed -H &quot;Accept: application/json&quot; -X GET &quot;http://host.domain.com:8088/proxy/application_1326821518301_0010/ws/v1/mapreduce/jobs&quot;
</pre></div></div>
<p>Output:</p>
<div class="source">
<div class="source">
<pre>{
&quot;jobs&quot; : {
&quot;job&quot; : [
{
&quot;runningReduceAttempts&quot; : 1,
&quot;reduceProgress&quot; : 72.104515,
&quot;failedReduceAttempts&quot; : 0,
&quot;newMapAttempts&quot; : 0,
&quot;mapsRunning&quot; : 0,
&quot;state&quot; : &quot;RUNNING&quot;,
&quot;successfulReduceAttempts&quot; : 0,
&quot;reducesRunning&quot; : 1,
&quot;acls&quot; : [
{
&quot;value&quot; : &quot; &quot;,
&quot;name&quot; : &quot;mapreduce.job.acl-modify-job&quot;
},
{
&quot;value&quot; : &quot; &quot;,
&quot;name&quot; : &quot;mapreduce.job.acl-view-job&quot;
}
],
&quot;reducesPending&quot; : 0,
&quot;user&quot; : &quot;user1&quot;,
&quot;reducesTotal&quot; : 1,
&quot;mapsCompleted&quot; : 1,
&quot;startTime&quot; : 1326860720902,
&quot;id&quot; : &quot;job_1326821518301_10_10&quot;,
&quot;successfulMapAttempts&quot; : 1,
&quot;runningMapAttempts&quot; : 0,
&quot;newReduceAttempts&quot; : 0,
&quot;name&quot; : &quot;Sleep job&quot;,
&quot;mapsPending&quot; : 0,
&quot;elapsedTime&quot; : 64432,
&quot;reducesCompleted&quot; : 0,
&quot;mapProgress&quot; : 100,
&quot;diagnostics&quot; : &quot;&quot;,
&quot;failedMapAttempts&quot; : 0,
&quot;killedReduceAttempts&quot; : 0,
&quot;mapsTotal&quot; : 1,
&quot;uberized&quot; : false,
&quot;killedMapAttempts&quot; : 0,
&quot;finishTime&quot; : 0
}
]
}
}
</pre></div></div>
<p>The user then wishes to get the task details about the job with job id job_1326821518301_10_10 that was listed above.</p>
<div class="source">
<div class="source">
<pre> curl --compressed -H &quot;Accept: application/json&quot; -X GET &quot;http://host.domain.com:8088/proxy/application_1326821518301_0010/ws/v1/mapreduce/jobs/job_1326821518301_10_10/tasks&quot;
</pre></div></div>
<p>Output:</p>
<div class="source">
<div class="source">
<pre>{
&quot;tasks&quot; : {
&quot;task&quot; : [
{
&quot;progress&quot; : 100,
&quot;elapsedTime&quot; : 5059,
&quot;state&quot; : &quot;SUCCEEDED&quot;,
&quot;startTime&quot; : 1326860725014,
&quot;id&quot; : &quot;task_1326821518301_10_10_m_0&quot;,
&quot;type&quot; : &quot;MAP&quot;,
&quot;successfulAttempt&quot; : &quot;attempt_1326821518301_10_10_m_0_0&quot;,
&quot;finishTime&quot; : 1326860730073
},
{
&quot;progress&quot; : 72.104515,
&quot;elapsedTime&quot; : 0,
&quot;state&quot; : &quot;RUNNING&quot;,
&quot;startTime&quot; : 1326860732984,
&quot;id&quot; : &quot;task_1326821518301_10_10_r_0&quot;,
&quot;type&quot; : &quot;REDUCE&quot;,
&quot;successfulAttempt&quot; : &quot;&quot;,
&quot;finishTime&quot; : 0
}
]
}
}
</pre></div></div>
<p>The map task has finished but the reduce task is still running. The users wishes to get the task attempt information for the reduce task task_1326821518301_10_10_r_0, note that the Accept header isn&#x2019;t really required here since JSON is the default output format:</p>
<div class="source">
<div class="source">
<pre> curl --compressed -X GET &quot;http://host.domain.com:8088/proxy/application_1326821518301_0010/ws/v1/mapreduce/jobs/job_1326821518301_10_10/tasks/task_1326821518301_10_10_r_0/attempts&quot;
</pre></div></div>
<p>Output:</p>
<div class="source">
<div class="source">
<pre>{
&quot;taskAttempts&quot; : {
&quot;taskAttempt&quot; : [
{
&quot;elapsedMergeTime&quot; : 158,
&quot;shuffleFinishTime&quot; : 1326860735378,
&quot;assignedContainerId&quot; : &quot;container_1326821518301_0010_01_000003&quot;,
&quot;progress&quot; : 72.104515,
&quot;elapsedTime&quot; : 0,
&quot;state&quot; : &quot;RUNNING&quot;,
&quot;elapsedShuffleTime&quot; : 2394,
&quot;mergeFinishTime&quot; : 1326860735536,
&quot;rack&quot; : &quot;/10.10.10.0&quot;,
&quot;elapsedReduceTime&quot; : 0,
&quot;nodeHttpAddress&quot; : &quot;host.domain.com:8042&quot;,
&quot;type&quot; : &quot;REDUCE&quot;,
&quot;startTime&quot; : 1326860732984,
&quot;id&quot; : &quot;attempt_1326821518301_10_10_r_0_0&quot;,
&quot;finishTime&quot; : 0
}
]
}
}
</pre></div></div>
<p>The reduce attempt is still running and the user wishes to see the current counter values for that attempt:</p>
<div class="source">
<div class="source">
<pre> curl --compressed -H &quot;Accept: application/json&quot; -X GET &quot;http://host.domain.com:8088/proxy/application_1326821518301_0010/ws/v1/mapreduce/jobs/job_1326821518301_10_10/tasks/task_1326821518301_10_10_r_0/attempts/attempt_1326821518301_10_10_r_0_0/counters&quot;
</pre></div></div>
<p>Output:</p>
<div class="source">
<div class="source">
<pre>{
&quot;JobTaskAttemptCounters&quot; : {
&quot;taskAttemptCounterGroup&quot; : [
{
&quot;counterGroupName&quot; : &quot;org.apache.hadoop.mapreduce.FileSystemCounter&quot;,
&quot;counter&quot; : [
{
&quot;value&quot; : 4216,
&quot;name&quot; : &quot;FILE_BYTES_READ&quot;
},
{
&quot;value&quot; : 77151,
&quot;name&quot; : &quot;FILE_BYTES_WRITTEN&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;FILE_READ_OPS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;FILE_LARGE_READ_OPS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;FILE_WRITE_OPS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;HDFS_BYTES_READ&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;HDFS_BYTES_WRITTEN&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;HDFS_READ_OPS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;HDFS_LARGE_READ_OPS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;HDFS_WRITE_OPS&quot;
}
]
},
{
&quot;counterGroupName&quot; : &quot;org.apache.hadoop.mapreduce.TaskCounter&quot;,
&quot;counter&quot; : [
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;COMBINE_INPUT_RECORDS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;COMBINE_OUTPUT_RECORDS&quot;
},
{
&quot;value&quot; : 1767,
&quot;name&quot; : &quot;REDUCE_INPUT_GROUPS&quot;
},
{
&quot;value&quot; : 25104,
&quot;name&quot; : &quot;REDUCE_SHUFFLE_BYTES&quot;
},
{
&quot;value&quot; : 1767,
&quot;name&quot; : &quot;REDUCE_INPUT_RECORDS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;REDUCE_OUTPUT_RECORDS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;SPILLED_RECORDS&quot;
},
{
&quot;value&quot; : 1,
&quot;name&quot; : &quot;SHUFFLED_MAPS&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;FAILED_SHUFFLE&quot;
},
{
&quot;value&quot; : 1,
&quot;name&quot; : &quot;MERGED_MAP_OUTPUTS&quot;
},
{
&quot;value&quot; : 50,
&quot;name&quot; : &quot;GC_TIME_MILLIS&quot;
},
{
&quot;value&quot; : 1580,
&quot;name&quot; : &quot;CPU_MILLISECONDS&quot;
},
{
&quot;value&quot; : 141320192,
&quot;name&quot; : &quot;PHYSICAL_MEMORY_BYTES&quot;
},
{
&quot;value&quot; : 1118552064,
&quot;name&quot; : &quot;VIRTUAL_MEMORY_BYTES&quot;
},
{
&quot;value&quot; : 73728000,
&quot;name&quot; : &quot;COMMITTED_HEAP_BYTES&quot;
}
]
},
{
&quot;counterGroupName&quot; : &quot;Shuffle Errors&quot;,
&quot;counter&quot; : [
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;BAD_ID&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;CONNECTION&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;IO_ERROR&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;WRONG_LENGTH&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;WRONG_MAP&quot;
},
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;WRONG_REDUCE&quot;
}
]
},
{
&quot;counterGroupName&quot; : &quot;org.apache.hadoop.mapreduce.lib.output.FileOutputFormatCounter&quot;,
&quot;counter&quot; : [
{
&quot;value&quot; : 0,
&quot;name&quot; : &quot;BYTES_WRITTEN&quot;
}
]
}
],
&quot;id&quot; : &quot;attempt_1326821518301_10_10_r_0_0&quot;
}
}
</pre></div></div>
<p>The job finishes and the user wishes to get the final job information from the history server for this job.</p>
<div class="source">
<div class="source">
<pre> curl --compressed -X GET &quot;http://host.domain.com:19888/ws/v1/history/mapreduce/jobs/job_1326821518301_10_10&quot;
</pre></div></div>
<p>Output:</p>
<div class="source">
<div class="source">
<pre>{
&quot;job&quot; : {
&quot;avgReduceTime&quot; : 1250784,
&quot;failedReduceAttempts&quot; : 0,
&quot;state&quot; : &quot;SUCCEEDED&quot;,
&quot;successfulReduceAttempts&quot; : 1,
&quot;acls&quot; : [
{
&quot;value&quot; : &quot; &quot;,
&quot;name&quot; : &quot;mapreduce.job.acl-modify-job&quot;
},
{
&quot;value&quot; : &quot; &quot;,
&quot;name&quot; : &quot;mapreduce.job.acl-view-job&quot;
}
],
&quot;user&quot; : &quot;user1&quot;,
&quot;reducesTotal&quot; : 1,
&quot;mapsCompleted&quot; : 1,
&quot;startTime&quot; : 1326860720902,
&quot;id&quot; : &quot;job_1326821518301_10_10&quot;,
&quot;avgMapTime&quot; : 5059,
&quot;successfulMapAttempts&quot; : 1,
&quot;name&quot; : &quot;Sleep job&quot;,
&quot;avgShuffleTime&quot; : 2394,
&quot;reducesCompleted&quot; : 1,
&quot;diagnostics&quot; : &quot;&quot;,
&quot;failedMapAttempts&quot; : 0,
&quot;avgMergeTime&quot; : 2552,
&quot;killedReduceAttempts&quot; : 0,
&quot;mapsTotal&quot; : 1,
&quot;queue&quot; : &quot;a1&quot;,
&quot;uberized&quot; : false,
&quot;killedMapAttempts&quot; : 0,
&quot;finishTime&quot; : 1326861986164
}
}
</pre></div></div>
<p>The user also gets the final applications information from the ResourceManager.</p>
<div class="source">
<div class="source">
<pre> curl --compressed -H &quot;Accept: application/json&quot; -X GET &quot;http://host.domain.com:8088/ws/v1/cluster/apps/application_1326821518301_0010&quot;
</pre></div></div>
<p>Output:</p>
<div class="source">
<div class="source">
<pre>{
&quot;app&quot; : {
&quot;finishedTime&quot; : 1326861991282,
&quot;amContainerLogs&quot; : &quot;http://host.domain.com:8042/node/containerlogs/container_1326821518301_0010_01_000001&quot;,
&quot;trackingUI&quot; : &quot;History&quot;,
&quot;state&quot; : &quot;FINISHED&quot;,
&quot;user&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;application_1326821518301_0010&quot;,
&quot;clusterId&quot; : 1326821518301,
&quot;finalStatus&quot; : &quot;SUCCEEDED&quot;,
&quot;amHostHttpAddress&quot; : &quot;host.domain.com:8042&quot;,
&quot;progress&quot; : 100,
&quot;name&quot; : &quot;Sleep job&quot;,
&quot;startedTime&quot; : 1326860715335,
&quot;elapsedTime&quot; : 1275947,
&quot;diagnostics&quot; : &quot;&quot;,
&quot;trackingUrl&quot; : &quot;http://host.domain.com:8088/proxy/application_1326821518301_0010/jobhistory/job/job_1326821518301_10_10&quot;,
&quot;queue&quot; : &quot;a1&quot;
}
}
</pre></div></div></section>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
&#169; 2008-2023
Apache Software Foundation
- <a href="http://maven.apache.org/privacy-policy.html">Privacy Policy</a>.
Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>