4

我已经在 100.100.0.158 VM 上配置了 Logstash + ES + kibana,并且 Kibana 在 apache 服务器下运行。端口 8080

现在我需要的是。. 我只需将 URL“100.100.0.158:8080/kibana”提供给客户端,以便客户端可以在 Web 上查看他的数据。

当我将此 URL 放在客户端浏览器上时,我收到此错误“无法在 http://"127.0.0.1":9200 联系弹性搜索,请确保可以从您的系统访问弹性搜索”

我需要用 IP 100.100.0.158:9200 或 127.0.0.1:9200 配置 ES 就可以了。. !

帮助 。. !

谢谢图沙尔

4

3 回答 3

4

如果您的 Kibana 和 ES 安装在同一个盒子上,您可以通过在 Kibana 的 config.js 文件中使用以下行让它自动检测 ES URL/IP:

/** @scratch /configuration/config.js/5
 * ==== elasticsearch
 *
 * The URL to your elasticsearch server. You almost certainly don't
 * want +http://localhost:9200+ here. Even if Kibana and Elasticsearch are on
 * the same host. By default this will attempt to reach ES at the same host you have
 * elasticsearch installed on. You probably want to set it to the FQDN of your
 * elasticsearch host
 */
elasticsearch: "http://"+window.location.hostname+":9200",

这是因为 Kibana 和 ES 之间的接口是通过 JavaScript 进行的,因此使用127.0.0.1localhost实际上指向客户端机器(浏览器正在运行)而不是服务器。

于 2013-12-23T10:33:32.743 回答
2

修改elasticsearch配置文件elasticsearch.yml

追加或修改以下配置:

# Enable or disable cross-origin resource sharing.
http.cors.enabled: true

# Which origins to allow.
http.cors.allow-origin: /https?:\/\/<*your\.kibana\.host*>(:[0-9]+)?/

这是由 kibana 页面尝试从 elasticsearch 加载 jason 数据引起的,出于安全原因,该页面将被阻止。

于 2014-11-21T08:53:09.873 回答
0

这是关于 iptables 规则的。Kibana 使用 9292 作为 web 端口,但对于 elasticsearch 查询使用 9200。因此,您必须在 iptables 中为这些端口添加行。

netstat -napt | grep -i LISTEN

你会看到这些端口:9200 9300 9301 9302 9292

iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 9200 -j ACCEPT

查看详细信息:http: //logstash.net/docs/1.3.3/tutorials/getting-started-simple

于 2014-03-24T10:02:25.753 回答