<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: how to get data from Yarn Resource Manager REST API using JAVA in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/how-to-get-data-from-Yarn-Resource-Manager-REST-API-using/m-p/178624#M140870</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16912/manikandanjeyabal029.html" nodeid="16912"&gt;@Manikandan Jeyabal&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Your question is not quite clear to me. If you really want to fetch data from the YARN Resource Manager REST API in Java, all you need to do is open an HttpURLConnection and get the data from any endpoint. E.g.:&lt;/P&gt;&lt;PRE&gt;URL url = new URL("http://" + rmHost + ":8088/ws/v1/cluster/apps");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
... // read and process your data
conn.disconnect();&lt;/PRE&gt;&lt;P&gt;But there is a much easier solution to get data from the RM in Java: &lt;A href="https://hadoop.apache.org/docs/stable/api/org/apache/hadoop/yarn/client/api/YarnClient.html"&gt;YarnClient&lt;/A&gt;, which is basically a Java API for YARN.&lt;/P&gt;&lt;PRE&gt;YarnClient yarnClient = YarnClient.createYarnClient();
Configuration conf = new YarnConfiguration();
conf.set("yarn.resourcemanager.hostname", "your RM hostname");
yarnClient.init(conf);
yarnClient.start();
for (ApplicationReport applicationReport : yarnClient.getApplications()) {
  System.out.println(applicationReport.getApplicationId());
}&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Apr 2018 15:38:18 GMT</pubDate>
    <dc:creator>gnovak</dc:creator>
    <dc:date>2018-04-25T15:38:18Z</dc:date>
    <item>
      <title>how to get data from Yarn Resource Manager REST API using JAVA</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-get-data-from-Yarn-Resource-Manager-REST-API-using/m-p/178622#M140868</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Could someone help me out how to start fetching data from YARN Rest API using Java. please share me some sample links.&lt;/P&gt;&lt;P&gt;Tanx and Regards,&lt;/P&gt;&lt;P&gt;MJ&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 21:02:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-get-data-from-Yarn-Resource-Manager-REST-API-using/m-p/178622#M140868</guid>
      <dc:creator>manikandanjeyab</dc:creator>
      <dc:date>2018-04-24T21:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to get data from Yarn Resource Manager REST API using JAVA</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-get-data-from-Yarn-Resource-Manager-REST-API-using/m-p/178623#M140869</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/16912/manikandanjeyabal029.html" nodeid="16912"&gt;@Manikandan Jeyabal&lt;/A&gt;&lt;P&gt;Please check below links&lt;/P&gt;&lt;P&gt;&lt;A href="https://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html" target="_blank"&gt;https://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/grisha/ruby-yarn" target="_blank"&gt;https://github.com/grisha/ruby-yarn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 08:43:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-get-data-from-Yarn-Resource-Manager-REST-API-using/m-p/178623#M140869</guid>
      <dc:creator>KuldeepK</dc:creator>
      <dc:date>2018-04-25T08:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to get data from Yarn Resource Manager REST API using JAVA</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-get-data-from-Yarn-Resource-Manager-REST-API-using/m-p/178624#M140870</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16912/manikandanjeyabal029.html" nodeid="16912"&gt;@Manikandan Jeyabal&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Your question is not quite clear to me. If you really want to fetch data from the YARN Resource Manager REST API in Java, all you need to do is open an HttpURLConnection and get the data from any endpoint. E.g.:&lt;/P&gt;&lt;PRE&gt;URL url = new URL("http://" + rmHost + ":8088/ws/v1/cluster/apps");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
... // read and process your data
conn.disconnect();&lt;/PRE&gt;&lt;P&gt;But there is a much easier solution to get data from the RM in Java: &lt;A href="https://hadoop.apache.org/docs/stable/api/org/apache/hadoop/yarn/client/api/YarnClient.html"&gt;YarnClient&lt;/A&gt;, which is basically a Java API for YARN.&lt;/P&gt;&lt;PRE&gt;YarnClient yarnClient = YarnClient.createYarnClient();
Configuration conf = new YarnConfiguration();
conf.set("yarn.resourcemanager.hostname", "your RM hostname");
yarnClient.init(conf);
yarnClient.start();
for (ApplicationReport applicationReport : yarnClient.getApplications()) {
  System.out.println(applicationReport.getApplicationId());
}&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 15:38:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-get-data-from-Yarn-Resource-Manager-REST-API-using/m-p/178624#M140870</guid>
      <dc:creator>gnovak</dc:creator>
      <dc:date>2018-04-25T15:38:18Z</dc:date>
    </item>
  </channel>
</rss>

