PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, May 14, 2022

[FIXED] How to check if Elasticsearch is running using CURL?

 May 14, 2022     curl, elasticsearch, kibana, ubuntu     No comments   

Issue

I have downloaded the latest ElasticSearch & Kibana to my local machine (Ubuntu 20).

After extraction, I execute bin/elasticsearch & bin/kibana.

Execution successfully, I can open kibana running fine in my browser http://localhost:5601/

But from the CLI, using CURL command couldnot reach curl -XGET http://localhost:9200/`

In the document I have followed there is written a command to check if elasticsearch is up and running.

curl --cacert $ES_PATH_CONF/tls_auto_config_<timestamp>/http_ca.crt -u elastic https://localhost:9200

But I do not understand what is $ES_PATH_CONF/tls_auto_config_<timestamp>.

Can anybody please help me?


Solution

I am assuming you have followed the below steps to install on Linux as per documentation.

curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.0.1-linux-x86_64.tar.gz
tar -xzvf elasticsearch-8.0.1-linux-x86_64.tar.gz
cd elasticsearch-8.0.1
./bin/elasticsearch

According to this step you must be in elasticsearch-8.0.1.

/elasticsearch-8.0.1 - ES_HOME folder.
/elasticsearch-8.0.1/config - ES_PATH_CONF folder.
/elasticsearch-8.0.1/config/certs/http_ca.crt - HTTP CA Certificate.

When you start Elasticsearch for the first time, passwords are generated for the elastic user and TLS is automatically configured for you.

Open same path in another terminal window or tab.

So you need to pass the http_ca.crt path to the curl command like below.

curl --cacert config/certs/http_ca.crt -u "elastic:password" https://localhost:9200

Also You can set the environment variable.

export ES_HOME=/path-to-ES_HOME/elasticsearch-8.0.1
export ES_PATH_CONF=/path-to-ES_HOME/elasticsearch-8.0.1/config

You can use environment variable directly in curl

curl --cacert $ES_PATH_CONF/certs/http_ca.crt -u "elastic:password" https://localhost:9200

The password must have shown while installing the elasticsearch. If you have not noted, you can change with below command:

bin/elasticsearch-reset-password -u elastic

You can refer more here https://www.elastic.co/guide/en/elasticsearch/reference/current/targz.html#_check_that_elasticsearch_is_running



Answered By - Ashish Tiwari
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing