2017-03-07 76 views
0

我有我的服务器上运行的elasicsearch实例。我必须配置它,只能通过本地计算机的公共IP进行访问。我尝试将network.host:更改为我的本地IP,但它不起作用。谁能告诉我我做错了什么。Elasticsearch访问本地计算机

+0

你是在一个错误的方式看netowork.host。阅读http://stackoverflow.com/questions/42019852/how-do-i-enable-remote-access-in-elasticsearch-5-2-0-from-selected-devices-compu/42020369#42020369 – user3775217

+0

那么,有没有任何我能达到我想要的方式? –

+0

你想保护它只是为了访问你的IP,或者你只是想启用远程访问? – user3775217

回答

0

那么我可以在这里建议你两两件事。

1)无论你把nginx reverse proxy在elasticsearch服务器前端和过滤要允许连接elasticsearch IP地址。

在在/ usr /本地/ nginx的/ conf目录/ nginx.conf文件,更info

location/{ 
    # block one workstation 
    deny 192.168.1.1; 
    # allow anyone in 192.168.1.0/24 
    allow 192.168.1.0/24; 
    # drop rest of the world 
    deny all; 
} 

2),也可以使用elastic shield plugin其自带X-包,你可以使用IP过滤功能限制访问您的elasticcluster。

在elasticsearch.yml文件

shield.transport.filter.allow: "192.168.0.1" 
shield.transport.filter.deny: "192.168.0.0/24" 

您也可以使用他们的REST API修改这些设置

curl -XPUT localhost:9200/_cluster/settings -d '{ 
    "persistent" : { 
     "shield.transport.filter.allow" : "172.16.0.0/24" 
    } 
}' 

更多here。 感谢

相关问题