获取active nn并替换hue.ini
namenodelists="nnip1,nnip2"
nn1=$(echo $namenodelists | cut -d "," -f )
nn2=$(echo $namenodelists | cut -d "," -f )
nn1state=$(curl "http://$nn1:50070/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus"|grep -c active)
nn2state=$(curl "http://$nn2:50070/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus"|grep -c active) source /etc/profile
source /root/.profile
curr_nn=$(grep -Po -m1 "http://(.*):50070" /usr/share/hue/desktop/conf/hue.ini |cut -d ':' -f |cut -d "/" -f )
echo $curr_nn
if [ $nn1state -eq ]; then
activenn=$nn1
if [ "X$curr_nn" != "X$activenn" ]; then
echo "nn change, now active is $activenn"
sed -i "s|fs_defaultfs=.*|webhdfs_url=http://$activenn:50070/webhdfs/v1|" /usr/share/hue/desktop/conf/hue.ini
sed -i "s|webhdfs_url=.*|webhdfs_url=http://$activenn:50070/webhdfs/v1|" /usr/share/hue/desktop/conf/hue.ini
ps -ef|grep hue |grep -v grep |awk '{print $2}' |xargs kill - >/dev/null
/usr/bin/nohup /usr/share/hue/build/env/bin/hue runserver 0.0.0.0: > /usr/share/hue/hue.log >& &
fi
fi
if [ $nn2state -eq ]; then
activenn=$nn2
if [ "X$curr_nn" != "X$activenn" ]; then
echo "nn change, now active is $activenn"
sed -i "s|fs_defaultfs=.*|webhdfs_url=http://$activenn:50070/webhdfs/v1|" /usr/share/hue/desktop/conf/hue.ini
sed -i "s|webhdfs_url=.*|webhdfs_url=http://$activenn:50070/webhdfs/v1|" /usr/share/hue/desktop/conf/hue.ini
ps -ef|grep hue |grep -v grep |awk '{print $2}' |xargs kill - >/dev/null
/usr/bin/nohup /usr/share/hue/build/env/bin/hue runserver 0.0.0.0: > /usr/share/hue/hue.log >& &
fi
fi
#start it if not start
live=`ps -ef|grep runserver|grep -v -c grep`
if [ $live -eq ]; then
/usr/bin/nohup /usr/share/hue/build/env/bin/python2. /usr/share/hue/build/env/bin/hue runserver 0.0.0.0: >& &
fi
当前使用hdp3.1,安装namenode ha,配置hue使用的时候需要安装httpfs,但这个版本的httpfs是空的包,安装后很多目录都没有,不能用,
所以采用了上面的方法,配置一个crontab * * * * * /xxx.sh 一分钟检查一次,如果active nn和配置文件中的active nn不一致,则就更新配置,
然后重启hue.
遇到的一个问题是配置在crontab 中不会把hue拉起来,测了很久发现`` $()有问题,改成``的方式是可以的。
上网查找相关的内容,也没有得到很好的解析,有一种说法是``中的内容本身就是经过转义的(和此也 无关的)
获取active nn并替换hue.ini的更多相关文章
- Hue的全局配置文件hue.ini(图文详解)
Hue版本:hue-3.9.0-cdh5.5.4 需要编译才能使用(联网) 说给大家的话:大家电脑的配置好的话,一定要安装cloudera manager.毕竟是一家人的.同时,我也亲身经历过,会有部 ...
- FATAL ha.BootstrapStandby: Unable to fetch namespace information from active NN at ***
This problem (Unable to fetch namespace information from active NN) occurs, because the active namen ...
- HUE配置文件hue.ini 的hdfs_clusters模块详解(图文详解)(分HA集群和非HA集群)
不多说,直接上干货! 我的集群机器情况是 bigdatamaster(192.168.80.10).bigdataslave1(192.168.80.11)和bigdataslave2(192.168 ...
- HUE配置文件hue.ini 的yarn_clusters模块详解(图文详解)(分HA集群和非HA集群)
不多说,直接上干货! 我的集群机器情况是 bigdatamaster(192.168.80.10).bigdataslave1(192.168.80.11)和bigdataslave2(192.168 ...
- HUE配置文件hue.ini 的hbase模块详解(图文详解)(分HA集群和非HA集群)
不多说,直接上干货! 我的集群机器情况是 bigdatamaster(192.168.80.10).bigdataslave1(192.168.80.11)和bigdataslave2(192.168 ...
- HUE配置文件hue.ini 的pig模块详解(图文详解)(分HA集群和非HA集群)
不多说,直接上干货! 一.默认的pig配置文件 ########################################################################### ...
- HUE配置文件hue.ini 的Spark模块详解(图文详解)(分HA集群和HA集群)
不多说,直接上干货! 我的集群机器情况是 bigdatamaster(192.168.80.10).bigdataslave1(192.168.80.11)和bigdataslave2(192.168 ...
- HUE配置文件hue.ini 的impala模块详解(图文详解)(分HA集群)
不多说,直接上干货! 我的集群机器情况是 bigdatamaster(192.168.80.10).bigdataslave1(192.168.80.11)和bigdataslave2(192.168 ...
- loadrunner获取毫秒及字符串替换实现
loadrunner获取毫秒及字符串替换实现 今天做一个性能测试,参数化要求创建用户名不可以重复,想来想不没有什么好的办法来避免用户名字的重复.所以就想用时间+随机数来实现,但是实现中遇到一个问题. ...
随机推荐
- Minimum Depth of Binary Tree最短深度
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...
- 两种获取python版本的方法
方法1:查看python版本 import sys print("当前python版本",sys.version) 方法2:cmd框中查看的两种方式
- 使用 git 来管理 PCB 版本
使用 git 来管理 PCB 版本 在传统的 PCB 版本管理是复制一份,再重命名,写上日期,写上修改日志. 自从接触了 git 后,发现 git 的版本管理完全可以胜任,且可以做的更好. 原来使用商 ...
- Java练习 SDUT-2728_最佳拟合直线
最佳拟合直线 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 在很多情况下,天文观测得到的数据是一组包含很大数量的序列点 ...
- 利用IDEA构建springboot应用-Controller的使用
Controller的使用 @Controller 处理http请求 @RestController Spring4之后新加的注解,原来返回json需要@ResponseBody配合@Contr ...
- nodeJs学习-02 fs模块(文件操作)
读文件: const fs = require('fs'); //读文件(异步) readFile(文件名,回调函数) fs.readFile('section03/testData/aaa.txt' ...
- python初识参数
1. 什么是函数? f(x) = x + 1 y = x + 1 函数是对功能或者动作的封装 2. 函数的语法和定义 def 函数名(): 函数体 调用: 函数名() 3. 关于函数的返回值 retu ...
- oracle函数 dbtimezone
[功能]:返回时区 [参数]:没有参数,没有括号 [返回]:字符型 [示例]select dbtimezone from dual;
- PHP 手机短信验证码 laravel 实现流程
https://blog.csdn.net/uknow0904/article/details/80336941 本人在自己博客(Laravel)的注册部分 使用手机号注册,需要发送短信验证码. 使用 ...
- poj 1716 Integer Intervals(差分约束)
1716 -- Integer Intervals 跟之前个人赛的一道二分加差分约束差不多,也是求满足条件的最小值. 题意是,给出若干区间,需要找出最少的元素个数,使得每个区间至少包含两个这里的元素. ...