Я пытаюсь подключить 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/
пусто.
Пожалуйста, что не так с curl?
http://127.0.0.1:9200
? Ваш браузер может выполнять для вас какое-то разрешение локального хоста, которого может не быть в вашем/etc/hosts
или что-то в этом роде. - person wholevinski   schedule 21.02.2018sudo netstat -anp | grep 9200
, чтобы убедиться, что он прослушивает коробку, из которой вы пытаетесь выполнить завивку? - person wholevinski   schedule 21.02.2018http://127.0.0.1:9200
ничего не дает.sudo netstat -anp | grep 9200
ничего не показывает :( - person kabrice   schedule 21.02.2018{ "name" : "Payback", "cluster_name" : "elasticsearch", "cluster_uuid" : "cXwea1mHQyeQrUCTF2lVJg", "version" : { "number" : "2.4.6", "build_hash" : "5376dca9f70f3abef96a77f4bb22720ace8240fd", "build_timestamp" : "2017-07-18T12:17:44Z", "build_snapshot" : false, "lucene_version" : "5.5.4" }, "tagline" : "You Know, for Search" }
- person kabrice   schedule 21.02.2018/var/log/elasticsearch/
не существует. Я установил elasticsearch с python (pip) - person kabrice   schedule 21.02.2018http://localhost:9200/_nodes
в своем браузере. Затем посетитеhttp://localhost:9200/_nodes/{node_name}
на основе возвращенных узлов. Это должно дать вам информацию о работающем узле. Затем проверьте IP-адрес ящика, который вы пытаетесь получить с помощьюifconfig -a
. Рискну предположить, что IP-адреса не совпадают. - person wholevinski   schedule 21.02.2018http://localhost:9200/_nodes/
:{"cluster_name":"elasticsearch","nodes":{"hSQhDjeHQFqx0FJf1iTwkQ":{"name":"Payback","transport_address":"10.0.2.15:9300","host":"10.0.2.15","ip":"10.0.2.15","version":"2.4.6","build":"5376dca","http_address":"10.0.2.15:9200","settings":{"pidfile":"/var/run/elasticsearch/elasticsearch.pid","cluster":{"name":"elasticsearch"}
- person kabrice   schedule 21.02.2018ifconfig -a
:10.0.2.15
. Нужна другая информация? - person kabrice   schedule 21.02.2018-4
к своей команде curl, чтобы принудительно использовать IPv4? После этого у меня закончились идеи... - person wholevinski   schedule 21.02.2018curl: (7) Failed to connect to localhost port 9200: Connection refused
- person kabrice   schedule 21.02.2018elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; bad; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2018-02-21 06:27:04 UTC; 9h ago Docs: http://www.elastic.co Main PID: 1691 (code=exited, status=1/FAILURE)
- person kabrice   schedule 21.02.2018Feb 21 06:27:04 ubuntu-xenial elasticsearch[1691]: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x000000008a660000, 1973026816, 0) failed; error='Cann Feb 21 06:27:04 ubuntu-xenial elasticsearch[1691]: # Feb 21 06:27:04 ubuntu-xenial elasticsearch[1691]: # There is insufficient memory for the Java Runtime Environment to continue. Feb 21 06:27:04 ubuntu-xenial elasticsearch[1691]: # Native memory allocation (mmap) failed to map 1973026816 bytes for committing reserved memory.
и так далее... - person kabrice   schedule 21.02.2018