ES-head插件无法通过浏览器工作

时间:2014-09-05 09:20:48

标签: plugins elasticsearch frontend head

我试图在我的服务器上运行elasticSearch-head插件,但我只能通过服务器终端访问它。如果我尝试通过浏览器访问它,它会尝试连接,直到"此页面不可用"浏览器消息显示。

如果我在终端输入"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

但是,如果我去浏览器并输入:X.X.X.X:9200 / _plugin / head /它只是没有显示任何内容。

我在这里失踪了什么?有什么猜测吗?

提前谢谢。

5 个答案:

答案 0 :(得分:1)

我在谷歌搜索几个小时之后遇到了同样的问题我发现你需要重新启动elasticsearch节点但是在你这样做之前一定要确保通过运行

来关闭elasticsearch
curl -XPOST localhost:9200/_shutdown

然后用

开始你的elasticsearch
sudo ./elasticsearch

答案 1 :(得分:1)

我发现(至少在2.x版本中,我之前不能说话)你不需要在安装head插件后弹跳elasticsearch。对我来说问题是,无论出于何种原因,我无法通过localhost:9200连接,但可以通过我的网络IP地址连接。我能够解决这个问题的方法是通过netstat -na | grep 9200

同样,为什么它选择这样做,我无法确认 - 我将我的/etc/hosts文件与我的工作桌面相匹配,我的工作桌面没有任何问题通过localhost连接。< / p>

我要做的另一件事就是将传输地址从localhost更改为我的网络IP,或者我在启动时获得NoSuchNodeException

答案 2 :(得分:1)

我遇到了同样的问题。我正在使用铬。 chrome中的开发人员工具向我指出了这个错误

  

XMLHttpRequest无法加载http://localhost:9200/_cluster/health。 No&#39; Access-Control-Allow-Origin&#39;标头出现在请求的资源上。起源&#39; null&#39;因此不允许访问。

上述错误的stackoverflow建议answer之一是使用以下chrome扩展来根据需要启用和禁用CORS。当启用此扩展时,弹头开始使用chrome。

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

答案 3 :(得分:0)

看起来您需要创建一个端口隧道来在本地计算机上访问它 - 您可以使用putty执行此操作。

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

答案 4 :(得分:0)

检查浏览器的代理设置。您可能不希望通过代理来获取本地请求。还要检查服务器和连接客户端上的防火墙设置。您没有指定您使用的浏览器和平台,因此很难提供进一步的帮助。

相关问题