Linux屏蔽stormui的kill功能的方法步骤

本篇内容介绍了“Linux屏蔽storm ui的kill功能的方法步骤”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

成都创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站制作、做网站、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的泰宁网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

  有两种方法:

  1.前端增加nginx,做location

分析ui页面,对应kill的button,html中的action为:

代码如下:

《input enabled=“” onclick=“confirmAction(‘xxxxxxxxxx’, ‘xxxxxxxx’, ‘kill’, true, 30)” type=“button” value=“Kill”》

调用了js的confirmAction方法,这个方法存在于storm-core/src/ui/public/js/script.js 中,方法的定义如下:

代码如下:

function confirmAction(id, name, action, wait, defaultWait) {var opts = {type:‘POST’,url:‘/topology/’ + id + ‘/’ + action};

if (wait) {

var waitSecs = prompt(‘Do you really want to ’ + action + ‘ topology “’ + name + ‘”? ’ +‘If yes, please, specify wait time in seconds:’,defaultWait);if (waitSecs != null && waitSecs != “” && ensureInt(waitSecs)) {opts.url += ‘/’ + waitSecs;} else {return false;}

} else if (!confirm(‘Do you really want to ’ + action + ‘ topology “’ + name + ‘”?’)) {return false;}

$(“input[type=button]”).attr(“disabled”, “disabled”);$.ajax(opts).always(function () {window.location.reload();}).fail(function () {alert(“Error while communicating with Nimbus.”)});return false;}

以看到方法主要分为两步,生成post请求的url,格式为‘/topology/’ + id + ‘/’ + action + ‘/’ + waitSecs,这里action为kill,waitSecs为触发kill时手动填入的时间,比如这里的30s,最终的url格式如下:

代码如下:

/topology/xxxxx/kill/xxxx

第二步就是根据这个设置触发一个ajax请求,这里我们只需要关心第一步即可,设置nginx如下:

代码如下:

upstream storm {

server 127.0.0.1:8888 weight=3 max_fails=3 fail_timeout=5s;}

server {

server_name storm.xxx.com;

listen 80;

proxy_set_header Host $host;

proxy_read_timeout 3600;

proxy_set_header X-Forwarded-For $remote_addr;access_log /var/log/nginx/storm.access.log main;error_log /var/log/nginx/storm.error.log debug;location ~* /topology/(.*)/kill/(.*) {return 403;}

location / {

proxy_pass http://storm;

}

}

这样,就可以屏蔽掉前端的kill功能了。

注意一个细节,storm ui的默认端口时8080,这个端口和nm冲突(见bug https://github.com/yahoo/storm-yarn/issues/25),设置storm.yaml ui.port: 8888,并重启ui即可。

  2.更改代码,去掉action相关的button

代码如下:

storm-core/src/ui/public/topology.html

去除掉下面的部分:

代码如下:

《div id=“topology-actions”》

《h3 class=“js-only”》Topology actions《/h3》

《p id=“topology-actions” class=“js-only”》

《/p》

《/div》

“Linux屏蔽storm ui的kill功能的方法步骤”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!

分享标题:Linux屏蔽stormui的kill功能的方法步骤
分享URL:https://www.cdcxhl.com/article28/ijhscp.html

成都网站建设公司_创新互联,为您提供域名注册定制开发品牌网站制作品牌网站设计服务器托管微信公众号

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

商城网站建设