Elasticsearch working fine on localhost but not from remote client

(Roshan Karwalkar) #1

Hi ,
I am new to ELK stack and I have installed ElasticSearch,Kibana and Logstash on my amazon ec2 instance.Currently I have started only kibana and elasticsearch.I am able to access elasticsearch from localhost but not able to open it from client brower.I have also opened port 9200,9300 from security group of ec2 instance.
curl -v GET "localhost:9200/"
given output as

        * Could not resolve host: GET
        * Closing connection 0
        curl: (6) Could not resolve host: GET
        *   Trying
        * TCP_NODELAY set
        * Connected to localhost ( port 9200 (#1)
        > GET / HTTP/1.1
        > Host: localhost:9200
        > User-Agent: curl/7.61.1
        > Accept: */*
        < HTTP/1.1 200 OK
        < content-type: application/json; charset=UTF-8
        < content-length: 493
          "name" : "8Hy7z_j",
          "cluster_name" : "elasticsearch",
          "cluster_uuid" : "OQlPNVsnRFeQgDbpShlOjA",
          "version" : {
            "number" : "6.6.2",
            "build_flavor" : "default",
            "build_type" : "rpm",
            "build_hash" : "3bd3e59",
            "build_date" : "2019-03-06T15:16:26.864148Z",
            "build_snapshot" : false,
            "lucene_version" : "7.6.0",
            "minimum_wire_compatibility_version" : "5.6.0",
            "minimum_index_compatibility_version" : "5.0.0"
          "tagline" : "You Know, for Search"
        * Connection #1 to host localhost left intact

$netstat -tulpn
tcp6 0 0 :::* LISTEN 11383/java

Startup logs of elasticsearch is as below

    [2019-03-18T10:44:21,707][DEBUG][o.e.a.ActionModule       ] [8Hy7z_j] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-03-18T10:44:22,141][INFO ][o.e.d.DiscoveryModule    ] [8Hy7z_j] using discovery type [zen] and host providers [settings]
[2019-03-18T10:44:23,517][INFO ][o.e.n.Node               ] [8Hy7z_j] initialized
[2019-03-18T10:44:23,517][INFO ][o.e.n.Node               ] [8Hy7z_j] starting ...
[2019-03-18T10:44:23,764][INFO ][o.e.t.TransportService   ] [8Hy7z_j] publish_address {}, bound_addresses {[::1]:9300}, {}
[2019-03-18T10:44:26,905][INFO ][o.e.c.s.MasterService    ] [8Hy7z_j] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {8Hy7z_j}{8Hy7z_jQQNmCjYR29TCPtA}{v7PB05OsSrCwDveC6J6Y_g}{}{}{ml.machine_memory=4134809600, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2019-03-18T10:44:26,910][INFO ][o.e.c.s.ClusterApplierService] [8Hy7z_j] new_master {8Hy7z_j}{8Hy7z_jQQNmCjYR29TCPtA}{v7PB05OsSrCwDveC6J6Y_g}{}{}{ml.machine_memory=4134809600, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {8Hy7z_j}{8Hy7z_jQQNmCjYR29TCPtA}{v7PB05OsSrCwDveC6J6Y_g}{}{}{ml.machine_memory=4134809600, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-03-18T10:44:26,995][INFO ][o.e.h.n.Netty4HttpServerTransport] [8Hy7z_j] publish_address {}, bound_addresses {[::1]:9200}, {}
[2019-03-18T10:44:26,996][INFO ][o.e.n.Node               ] [8Hy7z_j] started
[2019-03-18T10:44:27,425][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [8Hy7z_j] Failed to clear cache for realms [[]]
[2019-03-18T10:44:27,472][INFO ][o.e.l.LicenseService     ] [8Hy7z_j] license [766df63c-7d97-45f7-990b-f0791b363085] mode [basic] - valid
[2019-03-18T10:44:27,481][INFO ][o.e.g.GatewayService     ] [8Hy7z_j] recovered [1] indices into cluster_state
[2019-03-18T10:44:27,730][INFO ][o.e.c.r.a.AllocationService] [8Hy7z_j] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[.kibana_1][0]]

my elasticsearch.yml is

    path.data: /var/lib/elasticsearch
    path.logs: /var/log/elasticsearch
    http.port: 9200

any help will be appreciated!!

(David Pilato) #2

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:


This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

Here you need to change network.host. It defaults to the localhost interface.

(Roshan Karwalkar) #3

I added that to config and tried.


Still same issue.

Now netstat -tulpn shows

tcp6       0      0 :::9200                 :::*                    LISTEN      12008/java

(David Pilato) #4

Could you share the new logs then?

(Roshan Karwalkar) #5

Its resolved.Actually the issue was from our internal network.Firewall blocked outbound traffic from port 9200.
Anyway Thanks @dadoonet

(David Pilato) #6

That would have been my next question. :slight_smile:

(system) closed #7

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