Elasticsearch错误curl:(7)无法连接到本地主机端口9200:连接被拒绝,但本地主机:9200在浏览器上有效

卡布里斯

我正在尝试按照本教程将Elasticsearch 5.5.2连接到Django 2项目

curl -X GET 'http://localhost:9200'在终端上运行时,出现此错误:curl: (7) Failed to connect to localhost port 9200: Connection refused虽然localhost:9200在浏览器上运行良好。

这是我的elasticsearch.yml文件的概述:

# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true

# Elasticsearch performs poorly when the system is swapping the memory.
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 3
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

/var/log/elasticsearch/ 是空的。

请问卷曲有什么问题吗?

羽扇豆类

好的,尤里卡!,您有一个Java堆空间错误。查看该错误:

# There is insufficient memory for the Java Runtime Environment to continue

您可以增加/减少-我不知道问题是否由于您的计算机的RAM太少而无法启动,或者您为es分配的ram太少了-Java虚拟机中用于弹性化的空间编辑此文件/etc/elasticsearch/jvm.options要分配2 GB的RAM,您应该更改:

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

 -Xms2g
 -Xmx2g

然后,您必须重新启动服务

sudo service elasticsearch restart

然后尝试卷曲

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章