hdfs、yarn、hbase这些组件的master支持多个,实现自动主备切换,其中hdfs、hbase无论访问主master或者备master都可以正常访问页面,但是yarn比较特别,只有主master的页面可以访问,备master会返回Refresh,3s后重定向;

一种方式是提供两个域名,分别对应两个yarn的master,一旦有master切换,需要手工切换到另外一个,有没有更好的方式?

访问备master过程如下:

curl http://standby_ip:8088/cluster -v

* About to connect() to standby_ip port 8088 (#0)

*   Trying standby_ip...

* Connected to standby_ip (standby_ip) port 8088 (#0)

> GET /cluster HTTP/1.1

> User-Agent: curl/7.29.0

> Host: standby_ip:8088

> Accept: */*

>

< HTTP/1.1 200 OK

< Cache-Control: no-cache

< Expires: Tue, 25 Sep 2018 03:59:22 GMT

< Date: Tue, 25 Sep 2018 03:59:22 GMT

< Pragma: no-cache

< Expires: Tue, 25 Sep 2018 03:59:22 GMT

< Date: Tue, 25 Sep 2018 03:59:22 GMT

< Pragma: no-cache

< Content-Type: text/plain; charset=UTF-8

< Refresh: 3; url=http://active_ip:8088/cluster

< Content-Length: 103

< Server: Jetty(6.1.26)

<

This is standby RM. Redirecting to the current active RM: http://active_ip:8088/cluster

* Connection #0 to host standby_ip left intact

可见备master响应http status为200,包含Refresh头,同时body为This is standby RM. Redirecting to the current active RM:***

有没有可能在load balancer(比如nginx)上配置实现自动切换?这里非法响应需要判断header包含‘Refresh’或者判断body包含‘This is standby RM’

1)被动切换,支持http status以及timeout等判断,不满足

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream

proxy_next_upstream error | timeout | invalid_header | http_500 | http_502 | http_503 | http_504 | http_403 | http_404 | http_429 | non_idempotent | off ...;

2)主动健康检查,最常用的开源module,只支持http status级别的健康检查,不满足

https://github.com/yaoweibin/nginx_upstream_check_module

check_http_expect_alive

syntax: *check_http_expect_alive [ http_2xx | http_3xx | http_4xx |

http_5xx ]*

default: *http_2xx | http_3xx*

context: *upstream*

description: These status codes indicate the upstream server's http

response is ok, the backend is alive.

3)nginx收费版本的ngx_http_upstream_hc_module,支持header和body的判断,可以满足

Dynamically configurable group with periodic health checks is available as part of our commercial subscription:

http://nginx.org/en/docs/http/ngx_http_upstream_hc_module.html

match active {

body !~ "This is standby RM";

}

【原创】大叔经验分享(4)Yarn ResourceManager页面如何实现主被自动切换的更多相关文章

  1. 【原创】经验分享:一个小小emoji尽然牵扯出来这么多东西?

    前言 之前也分享过很多工作中踩坑的经验: 一个线上问题的思考:Eureka注册中心集群如何实现客户端请求负载及故障转移? [原创]经验分享:一个Content-Length引发的血案(almost.. ...

  2. Hadoop记录-yarn ResourceManager Active频繁易主问题排查(转载)

    一.故障现象 两个节点的ResourceManger频繁在active和standby角色中切换.不断有active易主的告警发出 许多任务的状态没能成功更新,导致一些任务状态卡在NEW_SAVING ...

  3. 【原创】大叔经验分享(21)yarn中查看每个应用实时占用的内存和cpu资源

    在yarn中的application详情页面 http://resourcemanager/cluster/app/$applicationId 或者通过application命令 yarn appl ...

  4. 【原创】大叔经验分享(19)spark on yarn提交任务之后执行进度总是10%

    spark 2.1.1 系统中希望监控spark on yarn任务的执行进度,但是监控过程发现提交任务之后执行进度总是10%,直到执行成功或者失败,进度会突然变为100%,很神奇, 下面看spark ...

  5. 【原创】大叔经验分享(1)在yarn上查看hive完整执行sql

    hive执行sql提交到yarn上的任务名字是被处理过的,通常只能显示sql的前边一段和最后几个字符,这样就会带来一些问题: 1)相近时间提交了几个相近的sql,相互之间无法区分: 2)一个任务有问题 ...

  6. 【原创】大叔经验分享(46)用户提交任务到yarn报错

    用户提交任务到yarn时有可能遇到下面的错误: 1) Requested user anything is not whitelisted and has id 980,which is below ...

  7. 【原创】大叔经验分享(49)hue访问hdfs报错/hue访问oozie editor页面卡住

    hue中使用hue用户(hue admin)访问hdfs报错: Cannot access: /. Note: you are a Hue admin but not a HDFS superuser ...

  8. 【原创】大叔经验分享(47)yarn开启日志归集

    yarn开启日志归集功能,除了配置之外 yarn.log-aggregation-enable=true 还要检查/tmp/logs目录是否存在以及权限,尤其是在开启kerberos之后,有些目录可能 ...

  9. 【原创】大叔经验分享(14)spark on yarn提交任务到集群后spark-submit进程一直等待

    spark on yarn通过--deploy-mode cluster提交任务之后,应用已经在yarn上执行了,但是spark-submit提交进程还在,直到应用执行结束,提交进程才会退出,有时这会 ...

随机推荐

  1. Django rest framework 使用haystack对接Elasticsearch

    Elasticsearch 介绍 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是 ...

  2. C# Note36: .NET unit testing framework

    It’s usually good practice to have automated unit tests while developing your code. Doing so helps y ...

  3. codeforces660C

    Hard Process CodeForces - 660C You are given an array a with n elements. Each element of a is either ...

  4. Sumdiv POJ 1845

    http://poj.org/problem?id=1845 题目 Time Limit: 1000MS   Memory Limit: 30000K Description Consider two ...

  5. 洛谷 P3455&BZOJ1101 【[POI2007]ZAP-Queries】

    这应该是入坑莫比乌斯反演的第一道题了吧 其实题目让我们求的东西很简单,就是 \[ ans=\sum_{i=1}^{a}\sum_{j=1}^{b}\left [ gcd(i,j)=k \right ] ...

  6. [SHOI2014]三叉神经树

    题目描述 计算神经学作为新兴的交叉学科近些年来一直是学术界的热点.一种叫做SHOI 的神经组织因为其和近日发现的化合物 SHTSC 的密切联系引起了人们的极大关注. SHOI 组织由若干个 SHOI ...

  7. android实用软件tasker应用设置

    设置连接wifi和充电两个调试都满足的情况下打开同步和psiphon3:在端任意wifi是断开或断电时同步和关掉psiphon3. 其他没有问题去到关掉psiphon3时出现小意外,不能直接关闭程序( ...

  8. python 爬虫之beautifulsoup(bs4)使用 --待完善

    #!/usr/bin/env python # -*- coding:utf- -*- from bs4 import BeautifulSoup import requests url = 'htt ...

  9. JavaScript null和undefined的区别

    前言 1995年javascript诞生时,最初像Java一样,只设置了null作为表示"无"的值.根据C语言的传统,null被设计成可以自动转为0 但是,javascript的设 ...

  10. $A,B$ 实对称 $\ra\tr((AB)^2)\leq \tr(A^2B^2)$

    设 $A,B$ 是 $n$ 阶实对称矩阵. 试证: $\tr((AB)^2)\leq \tr(A^2B^2)$. 又问: 等号何时成立? 证明:  由  $$\bex  \sum_i \sez{\su ...