Cannot access to localhost but node has started

Cannot access to localhost to check Elasticsearch status

Have already tried switching off the firewall. Still the same result. Currently running in docker in WS 2016 server. Elasticsearch 7.6.2.

Here is the log

[2020-04-30T15:37:25,534][INFO ][o.e.x.s.a.s.FileRolesStore] [node1] parsed [0] roles from file [C:\elasticsearch-7.6.2\config\roles.yml]
[2020-04-30T15:37:26,290][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [node1] [controller/4844] [Main.cc@110] controller (64 bit): Version 7.6.2 (Build e06ef9d86d5332) Copyright (c) 2020 Elasticsearch BV
[2020-04-30T15:37:27,684][DEBUG][o.e.a.ActionModule       ] [node1] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2020-04-30T15:37:27,834][INFO ][o.e.d.DiscoveryModule    ] [node1] using discovery type [zen] and seed hosts providers [settings]
[2020-04-30T15:37:28,731][INFO ][o.e.n.Node               ] [node1] initialized
[2020-04-30T15:37:28,731][INFO ][o.e.n.Node               ] [node1] starting ...
[2020-04-30T15:37:28,931][INFO ][o.e.t.TransportService   ] [node1] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2020-04-30T15:37:29,195][INFO ][o.e.c.c.Coordinator      ] [node1] setting initial configuration to VotingConfiguration{qUi8ELbeSguh3aL0jf-x_A}
[2020-04-30T15:37:29,500][INFO ][o.e.c.s.MasterService    ] [node1] elected-as-master ([1] nodes joined)[{node1}{qUi8ELbeSguh3aL0jf-x_A}{2H8C4oRxRUyUfCk0fjEQ0g}{127.0.0.1}{127.0.0.1:9300}{dlm}{ml.machine_memory=8589328384, xpack.installed=true, ml.max_open_jobs=20} elect
 leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, delta: master node changed {previous [], current [{node1}{qUi8ELbeSguh3aL0jf-x_A}{2H8C4oRxRUyUfCk0fjEQ0g}{127.0.0.1}{127.0.0.1:9300}{dlm}{ml.machine_memory=8589328384, xpack.installed=true, ml.max_op
en_jobs=20}]}
[2020-04-30T15:37:29,589][INFO ][o.e.c.c.CoordinationState] [node1] cluster UUID set to [7J3uhKsjR-6rAlcAL2v_xA]
[2020-04-30T15:37:29,657][INFO ][o.e.c.s.ClusterApplierService] [node1] master node changed {previous [], current [{node1}{qUi8ELbeSguh3aL0jf-x_A}{2H8C4oRxRUyUfCk0fjEQ0g}{127.0.0.1}{127.0.0.1:9300}{dlm}{ml.machine_memory=8589328384, xpack.installed=true, ml.max_open_jobs
=20}]}, term: 1, version: 1, reason: Publication{term=1, version=1}
[2020-04-30T15:37:30,421][INFO ][o.e.h.AbstractHttpServerTransport] [node1] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2020-04-30T15:37:30,421][INFO ][o.e.n.Node               ] [node1] started
[2020-04-30T15:37:31,383][INFO ][o.e.g.GatewayService     ] [node1] recovered [0] indices into cluster_state
[2020-04-30T15:37:31,695][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.watch-history-10] for index patterns [.watcher-history-10*]
[2020-04-30T15:37:31,877][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.watches] for index patterns [.watches*]
[2020-04-30T15:37:31,966][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2020-04-30T15:37:32,059][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [ilm-history] for index patterns [ilm-history-1*]
[2020-04-30T15:37:32,158][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.slm-history] for index patterns [.slm-history-1*]
[2020-04-30T15:37:32,269][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-7-*]
[2020-04-30T15:37:32,412][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-es] for index patterns [.monitoring-es-7-*]
[2020-04-30T15:37:32,535][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-beats] for index patterns [.monitoring-beats-7-*]
[2020-04-30T15:37:32,660][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-alerts-7] for index patterns [.monitoring-alerts-7]
[2020-04-30T15:37:32,742][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-7-*]
[2020-04-30T15:37:32,824][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [node1] adding index lifecycle policy [watch-history-ilm-policy]
[2020-04-30T15:37:33,133][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [node1] adding index lifecycle policy [slm-history-ilm-policy]
[2020-04-30T15:37:33,199][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [node1] adding index lifecycle policy [ilm-history-ilm-policy]
[2020-04-30T15:37:33,358][INFO ][o.e.l.LicenseService     ] [node1] license [49e9e84b-d3a1-49e0-a0d1-e44f7c7cda20] mode [basic] - valid
[2020-04-30T15:37:33,358][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [node1] Active license is now [BASIC]; Security is disabled 

Here is my elasticsearch.yml file

network.host: _local_

cluster.name: elasticsearch
cluster.initial_master_nodes: node1

node.master: true
node.data: true
node.ingest: false
node.name: node1

path.logs: C:\Elasticsearch\data
path.data: C:\Elasticsearch\logs
discovery.seed_hosts: 127.0.0.1, [::1]
http.port: 9200  

Would really appreciate the advice

How do you start it?

I use this command to start it

docker run --rm -p 9200:9200 -p 9300:9300 <imageid>

How are you checking this?

Do you have a corporate proxy by any chance?

Nope I dont have any corporate proxy, I am currently doing this on my local server.

I tried to access localhost:9200 through browser and also tried using curl but failed to see the Elasticsearch status. It's weird cause the log said it is already started.

What happens if you do a curl http://localhost:9200 inside the container?
Use docker exec -it <container id> /bin/bash then run the curl command.

I think you should remove network.host: _local_ at least when running on Docker.

1 Like

After I ran this command

docker exec -it 4db451a8eab4 /bin/bash curl http://localhost:9200

I got this prompted

container 4db451a8eab4f51a3f49cf8a50036124847a988ff96b59989f7b2ab103e47506 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"CommandLine":"/bin/bash curl http://localhost:9200","WorkingDirectory":"/","Environment":{"ELASTICSEARCH_HOME":"C:\\elasticsearch 7.6.2"},"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[0,0]}

Run first docker exec -it 4db451a8eab4 /bin/bash

Once you're inside the container, run curl http://localhost:9200

Sorry for the late reply.

When I did this
docker exec -it 4db451a8eab4 /bin/bash
It gives me this error still

container 4db451a8eab4f51a3f49cf8a50036124847a988ff96b59989f7b2ab103e47506 encountered an error during CreateProcess: failure in a Windows system call:
The system cannot find the file specified.
(0x2) extra info: {"CommandLine":"/bin/bash curl http://localhost:9200","WorkingDirectory":"/","Environment":{"ELASTICSEARCH_HOME":"C:\\elasticsearch 7.6.2"},
"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[0,0]}

Update: I edited the network host to 0.0.0.0

I can see the Elasticsearch status on web browse and curl if i input the publish_address. However, when I try to curl http://localhost:9200 it still doesn't show the status.

Does this mean its working correctly?

Perhaps, I got the error because I installed ES for windows

Here is my dockerfile if this helps

FROM mcr.microsoft.com/windows/servercore:ltsc2016 

# Build variable to allow passing in a specific version of ElasticSearch
ARG ELASTICSEARCH_VERSION=7.6.2
ARG ELASTICSEARCH_SOURCE=elasticsearch-${ELASTICSEARCH_VERSION}
ARG ELASTICSEARCH_ZIP=elasticsearch-${ELASTICSEARCH_VERSION}-windows-x86_64.zip

# Copy apps from sources to root directory
COPY sources /

RUN powershell -Command \
	#Extracts the zip to a folder then delete the zip
	Expand-Archive -Path $env:ELASTICSEARCH_ZIP -DestinationPath C:\; \
	Remove-Item -Path $env:ELASTICSEARCH_ZIP

	

# ELASTICSEARCH_HOME is used by RunElasticSearch.cmd file to launch ElasticSearch.
ENV ELASTICSEARCH_HOME C:\\${ELASTICSEARCH_SOURCE}


# Copy config files
COPY elasticsearch.yml ${ELASTICSEARCH_HOME}/config/

# Call file to start ELASTICSEARCH
CMD ["C:/RunElasticSearch.cmd"]


EXPOSE 9200 9300

Thank you

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