Can't Connect to Elasticsearch (through Curl)

后端 未结 4 1999
温柔的废话
温柔的废话 2021-02-20 17:03

I\'ve recently installed Elasticsearch and everything was working well for the first few days, but somehow today it stopped working

When I start the service, it claims t

相关标签:
4条回答
  • 2021-02-20 17:15

    curl -GET http://127.0.0.1:9200 is the wrong command.

    Try curl -XGET http://127.0.0.1:9200. It should return the short info about your running local node and status 200. If that doesn't work then something else must be wrong.

    0 讨论(0)
  • 2021-02-20 17:33

    Anyway, I'd try the command:

    curl -XGET http://localhost:9200

    0 讨论(0)
  • 2021-02-20 17:40

    Pay attention to memory allocation and usage. In case you let it use unlimited memory it might crash when you least suspect. Here is a tutorial on Elasticseach 5 and Kibana in case anyone else runs into this issue. https://medium.com/@adnanxteam/how-to-install-elasticsearch-5-and-kibana-on-homestead-vagrant-60ea757ff8c7

    0 讨论(0)
  • 2021-02-20 17:42

    1) Check what's the status of your port 9200, with lsof command in linux.

    In my case following is the result when elasticsearch is started.

    prayag@prayag:~$ sudo lsof -i TCP | grep 9200 
    chrome  2639 praayg   84u  IPv4 116310      0t0  TCP prayag.local:58989->10.0.4.70:9200 (ESTABLISHED)
    chrome  2639 prayag   99u  IPv4 116313      0t0  TCP prayag.local:58990->10.0.4.70:9200 (ESTABLISHED)
    java    7634 prayag  141u  IPv6 130960      0t0  TCP *:9200 (LISTEN)
    

    elasticsearch is not a service to me, otherwise to find the port es is running; on I could have checked,

    $ sudo lsof -iTCP -sTCP:LISTEN | grep elasticsearch
    

    2) check the elasticsearch endpoint

    $ curl -IGET http://localhost:9200
    HTTP/1.1 200 OK
    content-type: application/json; charset=UTF-8
    content-length: 327
    
    • -IGET is equivalent to --head that returns http response headers only.

    • response 200 means elasticsearch endpoint is responding properly.

    0 讨论(0)
提交回复
热议问题