13

I am running Elasticsearch and kibana, I am not sure of the status of my elasticsearsh cluster (if its red, yellow, or green) but it seems I need to get a token generated by elasticsearch as in the screenshot when I ran bin/elasticsearch-create-enrollment-token --scope kibana from the right directory it errors out ERROR: Failed to determine the health of the cluster..

enter image description here

Yusuf
  • 2,295
  • 7
  • 15
  • 34
  • What happened when you started elasticsearch ? Is there anything in the logs that indicated that elastisearch didn’t start correctly ? You don’t _need to use_ the enrollment token, you can also configure elastisearch and kibana manually, this is just supposed to be easier. The actual problem you are facing is that elastisearch didn’t start correctly and if you can figure out why, you can move forward. Please check the logs for elastisearch and maybe update the question with relevant error messages – Yiannis Kakavas Feb 23 '22 at 14:18

7 Answers7

12

According Ioannis Kakavas in discuss.elastic, "CLI tools extending BaseRunAsSuperuserCommand should only connect to the local node". When I run in a local node, it works. But when I run in the elasticsearch container in a cluster, it doesn't work. The solution was execute the elastic-search-reset-password and elasticsearch-create-enrollment-token scripts, respectively, like this (inside the elasticsearch container):

/usr/share/elasticsearch/bin/elasticsearch-reset-password -i -u elastic --url https://localhost:9200

/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana --url https://localhost:9200

Davi Carrano
  • 331
  • 2
  • 4
2

I encountered the same problem, and I just redid the process - unzipped the ES and kibana zip files again, and ran bin/elasticsearch in the newly created directory. Look for a message that is encapsulated in a formatted box that contains both the password for the elastic user, and the enrollment token for Kibana (the token is only valid for 30 minutes). This message will only appear once, the first time you run elasticsearch.

I proceeded to run bin/kibana for Kibana and configured it in the browser, and everything worked out from there. Hope this helps!

Shirley Ow
  • 383
  • 2
  • 7
  • 1
    great that this worked for you, it still not working for me after re-installations. i noticed that elasticsearch.yml file changed after running elasticseach for the first time – Mahlatse Oct 25 '22 at 08:40
1

I have the exact issue:

$ sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic

ERROR: Failed to determine the health of the cluster.

But after I restart the elasticsearch service:

$ sudo systemctl restart elasticsearch.service then it works:

This tool will reset the password of the [elastic] user to an autogenerated value.
The password will be printed in the console.
Please confirm that you would like to continue [y/N]y


Password for the [elastic] user successfully reset.
New value: xxxxxx
Jason Liu
  • 749
  • 4
  • 16
  • 34
0

Two possible solutions:

  • Make sure that you have enough disk space.
  • Your VPN might be causing the issue.
Chiel
  • 662
  • 1
  • 7
  • 30
0

Try using this command:

"elasticsearch-create-enrollment-token -s kibana --url "https://localhost:9200""

I got the same error and was able to generate the token after hitting this url. Just make sure that you are inside bin folder of elasticsearch. For me the bin folder is located at "C:\Users<username>\Downloads\Apps\elasticsearch-8.7.0\bin".

Also if you are not using localhost you can replace it with the ip address(e.g. 127.0.0.1 for localhost)

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
xvz_cdw
  • 11
  • 3
0

I encountered the same problem, and changed http.host to 127.0.0.1 then restart the Elasticsearch, then it goes well.

By the way, Elasticsearch version 8.8.2

Agung Kessawa
  • 533
  • 6
  • 18
jason
  • 1
  • 1
-2

The enrollment Token will be present in the terminal itself. You just need to scroll up till you find it when you are installing.

The reason for the error - ERROR: Failed to determine the health of the cluster is due to the fact that Elastic has not been installed yet and running that command is like calling a function without defining it.

Kshitij Agarwal
  • 2,060
  • 2
  • 8
  • 16