2014-09-05 57 views
5

我想在我的服務器上運行elasticSearch-head插件,但我只能通過服務器端訪問它。如果我嘗試通過瀏覽器訪問它,它會嘗試連接,直到顯示「此頁面不可用」瀏覽器消息。ES頭插件不能通過瀏覽器工作

如果我在終端上鍵入"curl -v http://localhost:9200/_plugin/head/",我得到

* Trying 127.0.0.1... 
* Connected to localhost (127.0.0.1) port 9200 (#0) 
> GET /_plugin/head/ HTTP/1.1 
> User-Agent: curl/7.36.0 
> Host: localhost:9200 
> Accept: */* 
> 
< HTTP/1.1 200 OK 
< Content-Type: text/html 
< Content-Length: 1077 
< 
<!DOCTYPE html> 

<html> 
     <head> 
       <meta charset="UTF-8"> 
       <title>elasticsearch-head</title> 
       <link rel="stylesheet" href="dist/base/reset.css"> 
       <link rel="stylesheet" href="dist/vendor.css"> 
       <link rel="stylesheet" href="dist/app.css"> 
       <script src="dist/i18n.js" data-baseDir="dist/lang" data-langs="en,fr,pt"></script> 
       <script src="dist/vendor.js"></script> 
       <script src="dist/app.js"></script> 
       <script> 
         window.onload = function() { 
           if(location.href.contains("/_plugin/")) { 
             var base_uri = location.href.replace(/_plugin\/.*/, ''); 
           } 
           var args = location.search.substring(1).split("&").reduce(function(r, p) { 
             r[decodeURIComponent(p.split("=")[0])] = decodeURIComponent(p.split("=")[1]); return r; 
           }, {}); 
           new app.App("body", { 
             id: "es", 
             base_uri: args["base_uri"] || base_uri, 
             auth_user : args["auth_user"] || "", 
             auth_password : args["auth_password"], 
             dashboard: args["dashboard"] 
           }); 
         }; 
       </script> 
       <link rel="icon" href="dist/base/favicon.png" type="image/png"> 
     </head> 
     <body></body> 
</html> 
* Connection #0 to host localhost left intact 

但是,如果我去一個瀏覽器和I型:X.X.X.X:9200/_plugin /頭/它只是不顯示任何東西。

什麼即時在這裏失蹤?任何猜測?

預先感謝您。

回答

0

看起來您需要創建一個端口隧道以在本地計算機上訪問它 - 您可以使用putty進行此操作。

http://howto.ccs.neu.edu/howto/windows/ssh-port-tunneling-with-putty/

+0

謝謝您的回答! 我試過了,但我得到了同樣的結果。瀏覽器等待並等待,直到我得到「這個網站不可用」:( – 2014-09-05 11:08:01

0

檢查你的代理服務器設置爲瀏覽器。您可能不想通過本地請求的代理。還要檢查服務器和連接客戶端上的防火牆設置。您沒有指定您使用的瀏覽器和平臺,因此很難提供進一步的幫助。

+0

即時通訊使用谷歌瀏覽器,但我試過瀏覽器和Firefox瀏覽器。所有與Windows。 服務器使用亞馬遜Linux。 – 2014-09-06 15:09:27

1

我面臨着同樣的問題,谷歌上搜索了幾個小時,我發現,你需要重新啓動elasticsearch節點之後,但在做之前一定要關閉,並運行

curl -XPOST localhost:9200/_shutdown 

然後用

啓動elasticsearch的elasticsearch
sudo ./elasticsearch 
1

我發現(至少在2.x版本中,我不能早點說出),你不需要在安裝head插件後反彈elasticsearch。我的問題是,無論出於何種原因,我無法通過localhost:9200進行連接,但可以通過我的網絡IP地址進行連接。我能夠解決這個問題的方式是通過netstat -na | grep 9200

同樣,爲什麼選擇這樣做,我無法確認 - 我將我的/etc/hosts文件與我的工作桌面相匹配,而我的工作桌面沒有任何問題通過localhost連接。

我不得不做的另一件事是更改是從localhost到我的網絡IP的傳輸地址,或者我在啓動時得到了NoSuchNodeException

1

我面臨同樣的問題。我正在使用鉻。 鉻中的開發工具指出我這個錯誤

XMLHttpRequest無法加載http://localhost:9200/_cluster/health。請求的資源上沒有「Access-Control-Allow-Origin」標題。因此不允許原產地'null'訪問。

對於上述錯誤,在stackoverflow上建議的answer之一是使用下面的chrome擴展來根據需要啓用和禁用CORS。當啓用此擴展時,彈性頭開始在鉻中工作。

https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/related?hl=en-US