#!/usr/bin/env bash
source /opt/client/bigdata_env
HARM=$("${HADOOP_HDFS_HOME}/bin/hdfs" getconf -confKey yarn.resourcemanager.ha.enabled 2>&-)
if [[ ${HARM} = "false" ]]; then
yarn_url=$("${HADOOP_HDFS_HOME}/bin/hdfs" getconf -confKey yarn.resourcemanager.webapp.address 2>&-)
yarn_url="http://${yarn_url}/ws/v1/cluster/apps?state=RUNNING&applicationType=Flink"
else
haids=$("${HADOOP_HDFS_HOME}/bin/hdfs" getconf -confKey yarn.resourcemanager.ha.rm-ids 2>&-)
haids=${haids//,/ }
for id in ${haids}; do
yarn_url=$("${HADOOP_HDFS_HOME}/bin/hdfs" getconf -confKey yarn.resourcemanager.webapp.https.address.${id} 2>&-)
curl -k -i --negotiate -u : "https://${yarn_url}/ws/v1/cluster/apps?state=RUNNING&applicationType=Flink" | grep "This is standby RM."
if [[ $? -ne 0 ]]; then
yarn_url=$("${HADOOP_HDFS_HOME}/bin/hdfs" getconf -confKey yarn.resourcemanager.webapp.address.${id} 2>&-)
curl -k -i --negotiate -u : "http://${yarn_url}/ws/v1/cluster/apps?state=RUNNING&applicationType=Flink" | grep "This is standby RM."
if [[ $? -eq 0 ]]; then
continue
else
yarn_url="http://${yarn_url}/ws/v1/cluster/apps?state=RUNNING&applicationType=Flink"
break
fi
else
if [[ $? -eq 0 ]]; then
continue
else
yarn_url="https://${yarn_url}/ws/v1/cluster/apps?state=RUNNING&applicationType=Flink"
break
fi
fi
done
fi
curl -k -i --negotiate -u : ${yarn_url}
获取resourcemanager页面(web页面url)脚本
最新推荐文章于 2023-05-11 17:46:52 发布