简体   繁体   English

Grafana-当用户名和密码可用于ES时,如何将elasticsearch添加为数据源?

[英]Grafana - How to add elasticsearch as a datasource when username and password are available for ES?

I set up x-pack, to provide an extra layer of security to Elasticsearch and now I am unable to use elasticsearch as a data source anymore. 我设置了x-pack,为Elasticsearch提供了额外的安全保护,现在我再也无法将Elasticsearch用作数据源了。 All I can see is a red alarming signal, showing that grafana failed to add the elasticsearch as a data source. 我所看到的只是一个红色警报信号,表明grafana无法将elasticsearch添加为数据源。

I provided the URL as, http://elastic:changeme@localhost:9200 我提供的网址为http:// elastic:changeme @ localhost:9200

用于带错误符号的Elasticsearch的Grafana数据源配置

There shouldn't be a problem to connect to an elasticsearch instance with Basic Auth from Grafana. 使用Grafana的Basic Auth连接到Elasticsearch实例应该没有问题。 Grafana even provides the possibility to enter the credentials by checking the Basic Auth field. Grafana甚至提供了通过检查“ Basic Auth身份Basic Auth字段来输入凭据的可能性。

What probably could cause problems in your setup is the way of providing basic auth credentials via direct access, so your browser directly issues the requests against the elasticsearch instance, which usually only works when you enable the matching CORS settings in elasticsearch. 可能会导致设置出现问题的是通过直接访问提供基本身份验证凭据的方式,因此您的浏览器会直接向Elasticsearch实例发出请求,通常仅在启用CORS中的匹配CORS设置时才有效。 But since grafana also allows to use its backend as a proxy for the calls, my suggestion is to use this way instead of opening elasticsearch to cross-origin calls. 但是由于grafana还允许使用其后端作为调用的代理,因此我的建议是使用这种方式,而不是对跨域调用开放elasticsearch。

For details, please see the grafana docs on the elasticsearch datasource . 有关详细信息,请参阅elasticsearch数据源上的grafana文档

So, please try to add your credentials in the grafana settings for Basic Auth and switch to proxy access instead of direct in the http settings section. 因此,请尝试在“ Basic Auth身份验证”的grafana设置中添加您的凭据,然后切换到proxy访问权限,而不是direct在http设置部分中direct访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM