【原创】大叔经验分享(4)Yarn ResourceManager页面如何实现主被自动切换

摘要:
hdfs、yarn和hbase等组件的主机支持多个,从而实现自动主/备用切换。HDfs和hbase可以正常访问页面,无论它们是访问主控还是备用主控,但纱线是特殊的。只有主机的页面可以访问,备用主机会返回Refresh,3s后会被重定向;一种方法是提供两个域名,对应于两个纱线主控器。一旦有了主开关,您需要手动切换到另一个。有更好的方法吗?

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

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

访问备master过程如下:

curlhttp://standby_ip:8088/cluster-v

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

* Trying standby_ip...

* Connected tostandby_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 hoststandby_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页面如何实现主被自动切换》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇C#简单一句代码,实现pictureBox的照片另存为磁盘文件不出错ajax表单上传图片和数据下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

YARN Registry DNS启动提示“53端口被占用”错误的解决方法

错误提示: ERROR dns.PrivilegedRegistryDNSStarter (PrivilegedRegistryDNSStarter.java:init(61)) - Error initializing Registry DNSjava.net.BindException: Problem binding to [xxx:53] jav...

YARN安装及使用教程

YARN 官网 安装 去官网安装 安装yarn的下载压缩包,保证注册表和环境变量的硬写入,后期通过yarn安装全局包时比较方便也可以使用npm i yarn -g 使用 初始化一个新项目 yarn init 执行完成后,系统会生成一个package.json文件用来固化依赖 { "name": "npm", //项目名称 "version": "...

ERROR: Cannot set priority of registrydns process 33740

hdp安装yarn时,yarn registry dns无法启动。报错 ERROR: Cannot set priority of registrydns process xxxxx 原因: The default port for Registry DNS is 53. Check if that port is opened netstat -tnlp...

批量杀死yarn任务

for i in yarn application -list | grep -w ACCEPTED | awk '{print $1}' | grep application_; do yarn application -kill $i; done...

yarn上运行flink环境搭建

主要完成hadoop集群搭建和yarn上运行flink 1.搭建hadoop伪集群 主要是搭建hadoop MapReduce(yarn)和HDFS 1.1 下载&配置环境变量 这里下载的hadoop二进制包为 2.7.7,下载后解压到本地,假设是/usr/hadoop/hadoop-2.7.7 #HADOOP VARIABLES START e...

如何在Java应用中提交Spark任务?

最近看到有几个Github友关注了Streaming的监控工程——Teddy,所以思来想去还是优化下代码,不能让别人看笑话啊。于是就想改一下之前觉得最丑陋的一个地方——任务提交。 本博客内容基于Spark2.2版本~在阅读文章并想实际操作前,请确保你有: 一台配置好Spark和yarn的服务器 支持正常spark-submit --master yarn...