Can't Connect to Elasticsearch (through Curl)

后端 未结 4 1966
温柔的废话
温柔的废话 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: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.

提交回复
热议问题