本篇內(nèi)容介紹了“Linux屏蔽storm ui的kill功能的方法步驟”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!
成都創(chuàng)新互聯(lián)公司堅持“要么做到,要么別承諾”的工作理念,服務領(lǐng)域包括:網(wǎng)站制作、做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務,滿足客戶于互聯(lián)網(wǎng)時代的泰寧網(wǎng)站設計、移動媒體設計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡建設合作伙伴!
有兩種方法:
1.前端增加nginx,做location
分析ui頁面,對應kill的button,html中的action為:
代碼如下:
《input enabled=“” onclick=“confirmAction(‘xxxxxxxxxx’, ‘xxxxxxxx’, ‘kill’, true, 30)” type=“button” value=“Kill”》
調(diào)用了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為觸發(fā)kill時手動填入的時間,比如這里的30s,最終的url格式如下:
代碼如下:
/topology/xxxxx/kill/xxxx
第二步就是根據(jù)這個設置觸發(fā)一個ajax請求,這里我們只需要關(guān)心第一步即可,設置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功能了。
注意一個細節(jié),storm ui的默認端口時8080,這個端口和nm沖突(見bug https://github.com/yahoo/storm-yarn/issues/25),設置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)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!
分享標題:Linux屏蔽stormui的kill功能的方法步驟
分享URL:http://aaarwkj.com/article28/ijhscp.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供域名注冊、定制開發(fā)、品牌網(wǎng)站制作、品牌網(wǎng)站設計、服務器托管、微信公眾號
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)