AMP AMP
AMP
0
AMP

Elasticsearch: Failed to connect to localhost port 9200: Connection refused

Elasticsearch: Failed to connect to localhost port 9200: Connection refused

I installed Elasticsearch, but each time I tried to check the status I got the error

Error:

curl -X GET 'http://127.0.0.1:9200'
curl: (7) Failed to connect to localhost port 9200 after 0 ms: Connection refused

To fix this, open /etc/elasticsearch/elasticsearch.yml and add check the following configuration Line.
Default values:

cluster.name: my-application
network.host: 192.168.0.1
http.port: 9200
discovery.seed_hosts: ["host1", "host2"]
cluster.initial_master_nodes: ["node-1", "node-2"]
xpack.security.enabled: true
cluster.initial_master_nodes: ["systemhostname"]

Modified values:

cluster.name: elasticsearch
network.host: 127.0.0.1
http.port: 9200
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["127.0.0.1"]
xpack.security.enabled: false
#cluster.initial_master_nodes: ["systemhostname"]

Then restart the Elasticsearch service

Elastic Search Add a comment
a sample image
noah
asked Jun 12 2024
edited Jun 12 2024

Answer

AMP
0
AMP

It seems like your Elasticsearch instance isn't running or isn't configured correctly. Make sure to check your elasticsearch.yml settings, particularly network.host and http.port. After making changes, restart the Elasticsearch Build Now GG service and verify it's active with curl -X GET 'http://127.0.0.1:9200'.

Add a comment
a sample image
Helgaella99
asked Dec 18 2024
edited Dec 22 2024
Post your Answer