无法连接到Elasticsearch(通过Curl) [英] Can't Connect to Elasticsearch (through Curl)
问题描述
我最近安装了Elasticsearch,开始的头几天一切运行良好,但是今天不知何故
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 to be fine...
sudo /etc/init.d/elasticsearch start
* Starting Elasticsearch Server
...done.
但是随后我得到
curl -GET http ://127.0.0.1:9200
卷曲:(7)无法连接到主机
查看elasticsearch日志:
Looking at the elasticsearch logs:
[WARN ][bootstrap ] jvm uses the client vm, make sure to run `java` with the server vm for best performance by adding `-server` to the command line
$中添加`-server`来确保在服务器虚拟机上运行Java以获得最佳性能。 b $ b
好像有关于Java VM的警告;那可能是问题吗?我还应该尝试/看看什么?
Looks like there is a warning regarding the Java VM; could that be the problem? What else should I try/look at?
推荐答案
1)检查9200端口的状态,在Linux中使用 lsof
命令。
1) Check what's the status of your port 9200, with lsof
command in linux.
对于我来说,以下是的结果Elasticsearch
已启动。
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
对我不是服务,否则要找到正在运行的端口;
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)检查elasticsearch端点
$ curl -IGET http://localhost:9200
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 327
-
-IGET
等效于-head
,仅返回http响应标头。-IGET
is equivalent to--head
that returns http response headers only.响应
200
表示Elasticsearch端点响应正确。response
200
means elasticsearch endpoint is responding properly.这篇关于无法连接到Elasticsearch(通过Curl)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!