I'm on mac. Try to run Elastic Search use Docker Desktop. Below is the commands I ran. I have no problem to run query in Kibana, the problem is I can't connect to Elastic Search via localhost:9200. Please help!!
$docker network create elastic
$docker pull docker.elastic.co/elasticsearch/elasticsearch:8.1.2
$docker run --name es-node01 --net elastic -p 9200:9200 -p 9300:9300 -t docker.elastic.co/elasticsearch/elasticsearch:8.1.2
$docker pull docker.elastic.co/kibana/kibana:8.1.2
$docker run --name kib-01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.1.2
CodePudding user response:
Please remember to be specific in your questions. "Can't connect" - what happens when you try to connect?
If what you get is
curl: (52) Empty reply from server
The problem is that elasticsearch 8.0 defaults to turning security on, so you need a certificate and a password.
Full instructions are on the elasticsearch website
But the two steps that are new are:
Copy the certificate:
docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
and use the certificate and the password with curl:
curl --cacert http_ca.crt -u elastic https://localhost:9200
You will be prompted for a password. The password is printed when your Elasticsearch instance starts. Yes, it's buried in the log output, but there are blank lines, it's not hard to find. It looks like:
-> Elasticsearch security features have been automatically configured!
-> Authentication is enabled and cluster connections are encrypted.
-> Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
PLoSd-3iJTncwmdSAwaku
-> HTTP CA certificate SHA-256 fingerprint:
722460137abbd54249a056698d4ac3d05495de9c18e7ac4aba9e3e07814fe3c79
There is an extra step (and the same user (elastic) and password to access kibana.
Directions here: https://www.elastic.co/guide/en/kibana/current/docker.html