You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "Xuan Gong (JIRA)" <ji...@apache.org> on 2015/04/17 01:05:59 UTC

[jira] [Commented] (YARN-2605) [RM HA] Rest api endpoints doing redirect incorrectly

    [ https://issues.apache.org/jira/browse/YARN-2605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14498937#comment-14498937 ] 

Xuan Gong commented on YARN-2605:
---------------------------------

[~adhoot] Feel free to assign back to yourself, if you have already worked on this ticket.

[~steve_l] Please take a look.

Removed the refresh header,  add the location header to hold the redirect url, and set status as 307.
{code}
$ curl -i http://127.0.0.1:33188/ws/v1/cluster/metrics
HTTP/1.1 307 TEMPORARY_REDIRECT
Cache-Control: no-cache
Expires: Thu, 16 Apr 2015 23:01:47 GMT
Date: Thu, 16 Apr 2015 23:01:47 GMT
Pragma: no-cache
Expires: Thu, 16 Apr 2015 23:01:47 GMT
Date: Thu, 16 Apr 2015 23:01:47 GMT
Pragma: no-cache
Content-Type: text/plain; charset=UTF-8
Location: http://localhost:23188/ws/v1/cluster/metrics
Content-Length: 84
Server: Jetty(6.1.26)

This is standby RM. The redirect url ishttp://localhost:23188/ws/v1/cluster/metrics
{code}

If i do
{code}
$ curl -i -L http://127.0.0.1:33188/ws/v1/cluster/metrics
{code}
, it will redirect to the active rm and get the metrics.

> [RM HA] Rest api endpoints doing redirect incorrectly
> -----------------------------------------------------
>
>                 Key: YARN-2605
>                 URL: https://issues.apache.org/jira/browse/YARN-2605
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>    Affects Versions: 2.4.0
>            Reporter: bc Wong
>            Assignee: Anubhav Dhoot
>              Labels: newbie
>         Attachments: YARN-2605.1.patch
>
>
> The standby RM's webui tries to do a redirect via meta-refresh. That is fine for pages designed to be viewed by web browsers. But the API endpoints shouldn't do that. Most programmatic HTTP clients do not do meta-refresh. I'd suggest HTTP 303, or return a well-defined error message (json or xml) stating that the standby status and a link to the active RM.
> The standby RM is returning this today:
> {noformat}
> $ curl -i http://bcsec-1.ent.cloudera.com:8088/ws/v1/cluster/metrics
> HTTP/1.1 200 OK
> Cache-Control: no-cache
> Expires: Thu, 25 Sep 2014 18:34:53 GMT
> Date: Thu, 25 Sep 2014 18:34:53 GMT
> Pragma: no-cache
> Expires: Thu, 25 Sep 2014 18:34:53 GMT
> Date: Thu, 25 Sep 2014 18:34:53 GMT
> Pragma: no-cache
> Content-Type: text/plain; charset=UTF-8
> Refresh: 3; url=http://bcsec-2.ent.cloudera.com:8088/ws/v1/cluster/metrics
> Content-Length: 117
> Server: Jetty(6.1.26)
> This is standby RM. Redirecting to the current active RM: http://bcsec-2.ent.cloudera.com:8088/ws/v1/cluster/metrics
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)