我在我们网络中本地计算机上托管的服务器(ubuntu)上运行了elasticsearch。我们已将其用于测试,并希望通过本地计算机进行连接。机器lan ip是192.168.1.100。我的IP是192.168.1.54。
curl -X GET 'http://localhost:9200'
{
"name" : "node-1",
"cluster_name" : "norrath",
"cluster_uuid" : "0EqCQH1ZTSGzOOdq_Sf7EQ",
"version" : {
"number" : "6.2.1",
"build_hash" : "7299dc3",
"build_date" : "2018-02-07T19:34:26.990113Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
当我在机器上尝试时。.
curl 'http://192.168.1.100:9200'
curl: (7) Failed to connect to 192.168.1.100 port 9200: Connection refused
我要做的第一件事是按照数字海洋的说明进行更改
network.host: 0.0.0.0
使用netstat -atun
tcp6 0 0 :::9200 :::* LISTEN
tcp6 0 0 :::9300 :::* LISTEN
UFW状态
sudo ufw status
Status: inactive
我尝试了多个配置文件更改。
#http.cors.enabled: true
#http.cors.allow-origin: "/.*/"
#transport.host: 0.0.0.0
#transport.tcp.port: 9300
#http.port: 9200
network.host: 0.0.0.0
#network.bind_host: 0.0.0.0
#network.publish_host: 0.0.0.0
systemctl restart elasticsearch
仍然无法通过局域网连接。
答案 0 :(得分:0)
检查了netstat输出后,我意识到它正在侦听tcp6请求,但不是ipv4。将我的curl请求更改为inet6地址,并设置tcp / udp而不是tcp只能解决我们的问题。