如何连接到远程集群?

时间:2016-06-30 14:03:43

标签: elasticsearch

在插件头中,我已连接到localhost

enter image description here

当我尝试连接到另一个(http :: / host_name:9200)群集时,它给了我“群集运行状况:未连接” 如何连接到远程群集?

3 个答案:

答案 0 :(得分:1)

您似乎正在使用默认的Elasticsearch配置。

默认情况下,Elasticsearch仅绑定到localhost。您可以在config/elasticsearch.yml中查看配置。在elasticsearch.yml中设置network.host以将您的节点绑定到主机名或IP地址。请查看此文档以获取更多详细信息:

https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html

答案 1 :(得分:1)

您需要在elasticsearch.yml中允许CORS。 尝试添加:

http.cors.enabled: true
http.cors.allow-origin: "/.*/" 
network.host: 0.0.0.0

它应该显示头部UI。请注意,您需要微调此配置以进行生产使用。

希望我能帮到你!

答案 2 :(得分:0)

如果你正在使用elasticsearch-head,你可以添加auth用户并传递给url,然后使用连接盒中的主机名和端口。

因此,请使用以下网址访问该插件:

file:///Users/foo/elasticsearch-head/index.html?auth_user=foo&auth_password=bar

index.html有一些javascript使用这些变量进行身份验证。

此外,您的浏览器应允许CORS,因此请使用扩展程序。

相关问题