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. 使用VMware安装Ubuntu虚拟机,创建后开启显示黑屏的解决方法

    将使用的VMware-workstation-full-14.0.0.24051卸载改为使用VMware-workstation_full_12.1.1.6932. 安装VMware成功后,创建新的虚 ...

  2. springboot打jar包正常无法访问页面

    网上看到太多说版本换成 1.4.2.RELEASE. 可以将程序打成war包发布, 1.启动类改为 @Overrideprotected SpringApplicationBuilder config ...

  3. python的设计原则及设计模式

    python的设计原则及设计模式 七大设计原则 单一职责原则 [SINGLE RESPONSIBILITY PRINCIPLE] 一个类负责一项职责. 里氏替换原则 [LISKOV SUBSTITUT ...

  4. MySQL系列:性能优化

    1. 优化简介 MySQL性能优化包括:查询优化.数据库结构优化.MySQL服务器优化等. 2. 查询优化 2.1 分析查询语句 MySQL提供EXPLAIN和DESCRIBE,用来分析查询语句. E ...

  5. vhdl 数据类型转换 使用IEEE标准库numeric_std 需要进行两次转换 use ieee.numeric_std.all;

    use ieee.numeric_std.all;

  6. iOS Button添加阴影 和 圆角

    用iamgeview 加手势代替 self.headimageview = [[UIImageView alloc] initWithFrame:CGRectMake(IPHONEWIDTH(13), ...

  7. [SimplePlayer] 5. 向音频设备输出音频

    两种SDL音频输出方式 我们这里采用SDL来进行音频输出.SDL提供两种音频输出的方式: 如果在SDL_OpenAudio时不指定callback,那么可以调用SDL_QueueAudio主动地向音频 ...

  8. spring security oauth2 client_credentials模

    spring security oauth2 client_credentials模 https://www.jianshu.com/p/1c3eea71410e 序 本文主要简单介绍一下spring ...

  9. 1: jsp的4个作用域 pageScope、requestScope、sessionScope、applicationScope的区别

    1.区别: 1.page指当前页面有效.在一个jsp页面里有效 2.request 指在一次请求的全过程中有效,即从http请求到服务器处理结束,返回响应的整个过程,存放在HttpServletReq ...

  10. (二叉树 DFS 递归) leetcode 112. Path Sum

    Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all ...