Unable to connect remothly to elasticsearch 5.1.1


(Yoav) #1

Hello,
I have successfully installed ELK version 5.1.1
The Elastic , kibana and logstash are up and running

#service elasticsearch start
Starting elasticsearch: [  OK  ]

# curl -XGET 'localhost:9200/?pretty'
{
  "name" : "5gvYWYb",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "54tznb7hTfCWCfVP00SREA",
  "version" : {
    "number" : "5.1.1",
    "build_hash" : "5395e21",
    "build_date" : "2016-12-06T12:36:15.409Z",
    "build_snapshot" : false,
    "lucene_version" : "6.3.0"
  },
  "tagline" : "You Know, for Search"
}

So far so good.

The problem start when i am trying to connect to the linux machine REMOTHLY .
Or even when i am trying to telnet the machine locally to port 9200 :

# netstat -ntlup|grep 9200
tcp        0      0 ::ffff:127.0.0.1:9200       :::*                        LISTEN      8950/java           
tcp        0      0 ::1:9200                    :::*                        LISTEN      8950/java    

As you can see above it listenen to localhost on port 9200

# cat /etc/hosts
127.0.0.1      localhost localhost.localdomain localhost4 localhost4.localdomain4
::1            localhost localhost.localdomain localhost6 localhost6.localdomain6
172.22.xxx.x   xxxx  xxxx.xxx.xxx   <<<----My public ip adress 

# /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:A7:2C:38  
          inet addr:172.22.xxx.x  Bcast:172.22.xxx.xxx  Mask:255.xxx.xxx.0
          ....
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0

Also telnet to localhost is ofcorse working :
# telnet localhost 9200
Trying ::1...
Connected to localhost.
Escape character is '^]'.

But when i am trying to telnet port 9200 by the public ip address i get an error :

# telnet 172.22.xxx.x 9200
Trying 172.22.xxx.x...
telnet: connect to address 172.22.xxx.x: Connection refused

I found here : http://stackoverflow.com/questions/34449342/installed-elastic-search-on-server-but-cannot-connect-to-it-if-from-another-mach
that i should set network.bind_host: 0.0.0.0 in the elasticsearch.yml

The entry : network.bind_host does not exists in the elasticsearch.yml file
Adding this entry to the yml file cause the elasticsearch to crash upon startup.

I also tried to set :
network.host: 0.0.0.0 in elasticsearch.yml file and restart the elastsearch , but the elasticsearch failed to restart :

#  service elasticsearch stop
Stopping elasticsearch: [  OK  ]
#  service elasticsearch start
Starting elasticsearch: [  OK  ]

# curl -XGET 'localhost:9200/?pretty'
curl: (7) couldn't connect to host

Same thing happened when i have tried to set the PUBLIC IP Address :
network.host: 172.22.xxx.x

Please advise how i can enable a remote connection to the elasticsearch version 5.1.1

Regards


(Yoav) #2

Problem solved :slight_smile:

Enabling : network.host: 0.0.0.0 at the elasticsearc.yml file togther with
adding the following entries to /etc/security/limits.conf

End of file

elasticsearch soft memlock 65536
elasticsearch hard memlock 65536
elasticsearch nofile 65536
elasticsearch soft nproc 65536

Thanks


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.