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

本篇內(nèi)容介紹了“Linux屏蔽storm ui的kill功能的方法步驟”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

成都創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站制作、做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的泰寧網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

  有兩種方法:

  1.前端增加nginx,做location

分析ui頁(yè)面,對(duì)應(yīng)kill的button,html中的action為:

代碼如下:

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

調(diào)用了js的confirmAction方法,這個(gè)方法存在于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請(qǐng)求的url,格式為‘/topology/’ + id + ‘/’ + action + ‘/’ + waitSecs,這里action為kill,waitSecs為觸發(fā)kill時(shí)手動(dòng)填入的時(shí)間,比如這里的30s,最終的url格式如下:

代碼如下:

/topology/xxxxx/kill/xxxx

第二步就是根據(jù)這個(gè)設(shè)置觸發(fā)一個(gè)ajax請(qǐng)求,這里我們只需要關(guān)心第一步即可,設(shè)置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功能了。

注意一個(gè)細(xì)節(jié),storm ui的默認(rèn)端口時(shí)8080,這個(gè)端口和nm沖突(見(jiàn)bug https://github.com/yahoo/storm-yarn/issues/25),設(shè)置storm.yaml ui.port: 8888,并重啟ui即可。

  2.更改代碼,去掉action相關(guān)的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功能的方法步驟”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

分享標(biāo)題:Linux屏蔽stormui的kill功能的方法步驟
分享URL:http://bm7419.com/article28/ijhscp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、定制開(kāi)發(fā)品牌網(wǎng)站制作、品牌網(wǎng)站設(shè)計(jì)服務(wù)器托管、微信公眾號(hào)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)