13

我沉浸在 Elastic Search 的 2 小时中。我用 Marvel 成功安装了 ES(marvel.agent.enabled: false在 config/elasticsearch.yml 中),并且能够从 Sense 发出成功的请求。我重新启动了我的开发机器,现在当我在 Sense 上发出以下请求时,它会响应:

Request failed to get to the server (status code: 0):

Elasticsearch may not be reachable or you may need to check your CORS settings.If CORS is enabled, try turning off Sense's Basic Authentication support under Setting (cog icon).This will result in a less strict CORS enforcement by the browser.
Please check the marvel documentation for more information.

请求(来源):

PUT /megacorp/employee/1
{
"first_name" : "John",
"last_name" :  "Smith",
"age" :        25,
"about" :      "I love to go rock climbing",
"interests": [ "sports", "music" ]
}

按照指示,我通过在 curl 上发出类似请求来检查 ES 是否可访问:

要求:

curl -XPUT http://localhost:9200/megacorp/employee/100 -d '{ "first_name" : "test" }'

回复:

{"_index":"megacorp","_type":"employee","_id":"100","_version":1,"created":true}

这让我认为 ES 是可用的。

继续下一项检查“您可能需要检查您的 CORS 设置。”。我根据此建议将以下配置添加到 elasticsearch.yml(并重新启动 ES) :

http.cors.enabled: true
http.cors.allow-origin: /.*/  
http.cors.allow-credentials: true

但是行为没有变化。

在 Marvel/Smart 设置中切换“支持基本身份验证”也没有影响。

欢迎任何关于可能出现问题的指示。

4

7 回答 7

7

尝试在另一个浏览器上或在私人/隐身模式下运行 marvel/sense html 页面。我有同样的问题,这样做解决了它。我认为这是由于存储在 cookie 上的设置或某些不确定的原因。

于 2015-02-24T09:35:57.917 回答
5

I was having this same problem too and according to Elasticsearch's docs here: http://www.elastic.co/guide/en/marvel/current/configuration.html#cors, you have to enable CORS.

To summarize, open the elasticsearch.yml file in the config/ folder and put this

http.cors.enabled: true
http.cors.allow-origin: /.*/  
http.cors.allow-credentials: true 

somewhere in there, probably the "Network And HTTP" section.

Then, after I restarted elasticsearch, it worked fine for me in Marvel Sense.

于 2015-03-12T18:13:58.107 回答
1

在您的 ES 集群日志中(在一个节点中)找到一条看起来像的行

[INFO ][http ] [c7_64] bound_address {inet[/0:0:0:0:0:0:0:0:9201]}, publish_address {inet[/192.168.88.128:9201]}

您对之后的内容感兴趣publish_address。访问 Sense 时,请使用您在此处看到的 IP:PORT。在我的示例中,Sense URL 如下所示:

http://192.168.88.128:9201/_plugin/marvel/sense/index.html

CORS 部分主要适用于 Marvel 安装在单独集群中的场景,当 Marvel 安装在与被监控节点相同的集群中时不需要它。在集群中安装 Shield 时也需要它。

于 2015-10-13T07:04:02.873 回答
1

因此,当尝试有意义地运行命令时,请尝试使用托管服务器的机器的 IP 地址,而不是使用http://localhost:9200/_plugin/marvel/sense/index.html。这对我有用。

于 2015-09-22T19:26:20.600 回答
0

我在使用 Chrome 时遇到了同样的问题。清除浏览器数据解决了我的问题。它在历史 -> 清除浏览器数据 -> 检查 cookie 和其他站点和插件数据、缓存的图像和文件、自动填充表单数据、托管应用程序数据。

不知道是哪一个成功了,但我就是这样做的,而且效果很好。希望这可以帮助。

于 2017-01-17T18:31:51.953 回答
0

与 Marvel 没有严格关系,但是当我从需要的服务器“外部”连接到 elasticsearch 时遇到问题。

更改elasticsearch.yml主机正在侦听的配置 -侦听所有网络接口

network.host: 0.0.0.0

之后,根据您的服务器,您应该在防火墙上打开 tcp 端口(如果您使用 elasticsearch 的默认端口:9200)。例如在 Centos(或 RHEL)上,你应该运行:

sudo firewall-cmd --zone=public --add-port=9200/tcp --permanent
sudo firewall-cmd --reload
于 2017-03-14T07:29:27.457 回答
0

我也有同样的问题。确保服务器字段不为空。用本地填写字段后,我的问题得到了解决

于 2015-09-03T10:09:47.330 回答