当我network.bind_host:localhost时,它没有工作

时间:2017-01-02 07:41:46

标签: elasticsearch

我在aws ubuntu 14.04

中安装elasticsearch

install document

我在elasticsearch.yml

中更改了一些设置

elasticsearch.yml

#network.bind_host: 192.168.0.1

network.bind_host: localhost

该文件告诉我localhost擅长安全

当我开始弹性搜索时

sudo service elasticsearch restart

* Stopping Elasticsearch Server                                              [ OK ]
* Starting Elasticsearch Server

当我发送卷曲

sudo curl -X GET 'http://localhost:9200'

curl: (7) Failed to connect to localhost port 9200: Connection refused

所以我改变了network.bind_host

network.bind_host: 0.0.0.0

sudo curl -X GET 'http://localhost:9200'

{
  "status" : 200,
  "name" : "****",
  "cluster_name" : "elasticsearch_***",
  "version" : {
    "number" : "1.7.2",
    "build_hash" : "e12r1r33r3fs593f7202acbd816e8ec",
    "build_timestamp" : "2015-09-14T09:49:53Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}

但我认为0.0.0.0在我制作我的网站时是如此危险

请有人帮助我?

1 个答案:

答案 0 :(得分:1)

我的猜测是,您应该在弹性搜索yml中将Sqlite 3设置为network.hostlocalhost

127.0.0.1

默认情况下,network.host: localhost <-- try 127.0.0.1 as well 通常会绑定到network.bind_host。您可以查看this,了解更多详情。

为了以防万一,请尝试添加network.host,以便确保您可以访问ES端口,这可能看起来像这样。

http.port

希望它有所帮助!