Cannot connect to elasticsearch server instance on port 9200

I have installed Elasticsearch and when I run a curl localhost:9200 request on the machine it returns the expected response showing that Elasticsearch is running.

I have a Wordpress site on another server and I want to connect the Elasticpress plugin to my VPS Elasticsearch instance on port 9200 but the connection is refused. I have also tried connecting to the Elasticsearch server from my Mac Terminal using curl 185.143.45.163:9200 and this also returns the error: curl: (7) Failed to connect to 185.143.45.163 port 9200: Connection refused. I have tried this both with the server's ufw firewall disabled and also with the firewall enabled with port 9200 open. Still no joy connecting.

Could you please advise me what I have done wrong with the configuration?

elasticsearch.yml:

#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 185.143.45.163
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation 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

Welcome!

Could you please share the full logs?

1 Like

Hi

Sorry for my ignorance but there seems to be a lot of log files in /var/log/elasticsearch:

root@server:/var/log/elasticsearch# ll
total 504
drwxr-s--- 2 elasticsearch elasticsearch   4096 Dec  5 09:43 ./
drwxrwxr-x 9 root          syslog          4096 Dec  4 21:51 ../
-rw-r--r-- 1 elasticsearch elasticsearch 105582 Dec  5 14:04 gc.log
-rw-r--r-- 1 elasticsearch elasticsearch   2040 Dec  4 21:54 gc.log.00
-rw-r--r-- 1 elasticsearch elasticsearch  53056 Dec  4 21:54 gc.log.01
-rw-r--r-- 1 elasticsearch elasticsearch   2040 Dec  4 21:55 gc.log.02
-rw-r--r-- 1 elasticsearch elasticsearch 114825 Dec  5 09:27 gc.log.03
-rw-r--r-- 1 elasticsearch elasticsearch   2040 Dec  5 09:27 gc.log.04
-rw-r--r-- 1 elasticsearch elasticsearch  43561 Dec  5 09:27 gc.log.05
-rw-r--r-- 1 elasticsearch elasticsearch   2040 Dec  5 09:28 gc.log.06
-rw-r--r-- 1 elasticsearch elasticsearch  47946 Dec  5 09:29 gc.log.07
-rw-r--r-- 1 elasticsearch elasticsearch   2040 Dec  5 09:30 gc.log.08
-rw-r--r-- 1 elasticsearch elasticsearch   4716 Dec  5 01:30 melloo-2020-12-04-1.json.gz
-rw-r--r-- 1 elasticsearch elasticsearch   4448 Dec  5 01:30 melloo-2020-12-04-1.log.gz
-rw-r--r-- 1 elasticsearch elasticsearch  32645 Dec  5 09:30 melloo.log
-rw-r--r-- 1 elasticsearch elasticsearch      0 Dec  4 21:54 melloo_audit.json
-rw-r--r-- 1 elasticsearch elasticsearch      0 Dec  4 21:54 melloo_deprecation.json
-rw-r--r-- 1 elasticsearch elasticsearch      0 Dec  4 21:54 melloo_deprecation.log
-rw-r--r-- 1 elasticsearch elasticsearch      0 Dec  4 21:54 melloo_index_indexing_slowlog.json
-rw-r--r-- 1 elasticsearch elasticsearch      0 Dec  4 21:54 melloo_index_indexing_slowlog.log
-rw-r--r-- 1 elasticsearch elasticsearch      0 Dec  4 21:54 melloo_index_search_slowlog.json
-rw-r--r-- 1 elasticsearch elasticsearch      0 Dec  4 21:54 melloo_index_search_slowlog.log
-rw-r--r-- 1 elasticsearch elasticsearch  60681 Dec  5 09:30 melloo_server.json

Which file should I check?

Many thanks for your help.

melloo.log looks like the relevant one.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.