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. Linux下修改MySQL数据表中字段属性

    一.修改某个表的字段类型及指定为空或非空 alter table 表名称 change 字段名称 字段名称 字段类型 [是否允许非空]; alter table 表名称 modify 字段名称 字段类 ...

  2. 安卓调试工具adb返回的png截图,直接输出到控制台的修复问题

    原始出处:www.cnblogs.com/Charltsing/p/adbpngfix.html QQ:564955427 adb由于兼容性问题,会把0a替换成0d0a输出到控制台,这会造成png图片 ...

  3. OracleSql语句学习(三)

    --在SELECT子句中出现的函数或表达式会在结果集中作为字段名,这样的可读性差,因此可以为--这样的字段添加别名(别名中不能出现空隔,除非是用双引号括起来的)--别名中如果希望包含空隔或者区分大小写 ...

  4. linux下安装PHP扩展memcache

    公司的服务器 CentOS 7.5,PHP 5.6 下面都是最新的版本(支持到PHP5.6) 如需php7  下支持memcache扩展,请移步   https://www.cnblogs.com/h ...

  5. SQL Data Discovery and Classification

    The new version of SQL Server Management Studio (v17.5) brings with it a new feature: SQL Data Disco ...

  6. Nginx ServerName指令

    L:47

  7. nginx 80 端口 部署多个Web

    1.修改默认nginx.conf 文件 加入 include /usr/www/ngconfs/*.conf; 读取ngconfs文件下所有 *.conf文件 2.ngconfs 下多个文件创建 第二 ...

  8. Hdoj 1847.Good Luck in CET-4 Everybody! 题解

    Problem Description 大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此.当然,作为在考场浸润了十几载 ...

  9. Linux系统诊断必备技能之二:tcpdump抓包工具详解

    一.简述 TcpDump可以将网络中传送的数据包完全截获下来提供分析.它支持针对网络层.协议.主机.网络或端口的过滤,并提供and.or.not等逻辑语句来帮助你去掉无用的信息. Linux作为网络服 ...

  10. Eclipse拷贝动态的web工程修改context root的值

    Eclipse拷贝动态的web工程修改context root的值 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. context root的名称一般是我们访问URL时的PATH路径 ...