2015-12-30 141 views
1

我通过Berksfile制作了ElasticSearch服务器。ElasticSearch无法通过主机浏览器连接

然后安装到ElasticSearch 2.1.0。

我试图通过来宾操作系统执行此命令。

[[email protected] ~]$ curl http://localhost:9200 
{ 
    "name" : "vm1-berkshelf", 
    "cluster_name" : "elasticsearch", 
    "version" : { 
    "number" : "2.1.0", 
    "build_hash" : "72cd1f1a3eee09505e036106146dc1949dc5dc87", 
    "build_timestamp" : "2015-11-18T22:40:03Z", 
    "build_snapshot" : false, 
    "lucene_version" : "5.3.1" 
    }, 
    "tagline" : "You Know, for Search" 
} 

它可以连接。 但是,如果主机操作系统连接到此服务器,则无法连接。

curl http://192.168.33.12:9200 

我试着检查Iptables,但它看起来像所有端口都可用。

[[email protected] ~]$ sudo iptables -L 
Chain INPUT (policy ACCEPT) 
target  prot opt source    destination 

Chain FORWARD (policy ACCEPT) 
target  prot opt source    destination 

Chain OUTPUT (policy ACCEPT) 
target  prot opt source    destination 

你知道如何解决这个问题吗?

+0

可能重复[ES不听外部请求](http://stackoverflow.com/questions/34480618/es-not-listening-to-external-requests) – moliware

回答

1

从2.0版本开始,Elasticsearch binds to localhost by default(作为一种安全措施,可防止您的节点在未知的情况下连接到网络上的其他节点)。

所以,你需要做的仅仅是编辑您的elasticsearch.yml配置文件并更改network.bind_host设置是这样的:

network.bind_host: 0 

然后,您需要重新启动您的节点,这将是从远程主机访问使用你的curl命令。

相关问题