Terminal#1
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.9.1-linux-x86_64.tar.gz
$ tar -zxvf elasticsearch-8.9.1-linux-x86_64.tar.gz
$ cd elasticsearch-8.9.1
$ ls config/
$ cd bin
$ ./elasticsearch
Terminal#2
$ curl --cacert /home/ubuntu/elasticsearch-8.9.1/config/certs/http_ca.crt -u elastic https://localhost:9200
Enter host password for user 'elastic':
{
"name" : "ip-172-31-58-60",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "dvbfb_NLS6qy1iuhc4yvKA",
"version" : {
"number" : "8.9.1",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "a813d015ef1826148d9d389bd1c0d781c6e349f0",
"build_date" : "2023-08-10T05:02:32.517455352Z",
"build_snapshot" : false,
"lucene_version" : "9.7.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
Elasticsearch 8.X in Centos 7 | |
------------------------------- | |
192.168.1.8 | |
https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html | |
$ yum install wget unzip -y | |
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.4.2-linux-x86_64.tar.gz | |
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.4.2-linux-x86_64.tar.gz.sha512 | |
$ shasum -a 512 -c elasticsearch-8.4.2-linux-x86_64.tar.gz.sha512 | |
$ tar -xzf elasticsearch-8.4.2-linux-x86_64.tar.gz | |
$ cd elasticsearch-8.4.2/ | |
---------------------------------------- | |
elasticsearch can not with user called "root" | |
$ useradd elastic | |
$ passwd elastic | |
$ su elastic | |
Elasticsearch security features have been automatically configured! | |
Authentication is enabled and cluster connections are encrypted. | |
Password for the elastic user | |
=========================================== | |
Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`): | |
YrfJHfoQtniJqzyD4pM3 | |
HTTP CA certificate SHA-256 fingerprint: | |
=========================================== | |
dc31d8f9d6d6f6223743e13a04fc0c107c1c253a37ef25d2a99b2733235b1e5e | |
Configure Kibana to use this cluster: | |
=========================================== | |
• Run Kibana and click the configuration link in the terminal when Kibana starts. | |
• Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes): | |
eyJ2ZXIiOiI4LjQuMiIsImFkciI6WyIxOTIuMTY4LjEuODo5MjAwIl0sImZnciI6ImRjMzFkOGY5ZDZkNmY2MjIzNzQzZTEzYTA0ZmMwYzEwN2MxYzI1M2EzN2VmMjVkMmE5OWIyNzMzMjM1YjFlNWUiLCJrZXkiOiJxMTlyWG9NQnNQMjdDeDNIUEFIZDp5bVJ4S1ZPWFM0ZWt4SS1RNzFicjJRIn0= | |
Configure other nodes to join this cluster: | |
=========================================== | |
• On this node: | |
⁃ Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`. | |
⁃ Uncomment the transport.host setting at the end of config/elasticsearch.yml. | |
⁃ Restart Elasticsearch. | |
• On other nodes: | |
⁃ Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated. | |
======================================= | |
curl http://localhost:9200 | |
curl --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic https://localhost:9200 | |
Enter host password for user 'elastic': | |
{ | |
"name" : "localhost.localdomain", | |
"cluster_name" : "elasticsearch", | |
"cluster_uuid" : "DwtXLUGKSB2Oy5piLMeArw", | |
"version" : { | |
"number" : "8.4.2", | |
"build_flavor" : "default", | |
"build_type" : "tar", | |
"build_hash" : "89f8c6d8429db93b816403ee75e5c270b43a940a", | |
"build_date" : "2022-09-14T16:26:04.382547801Z", | |
"build_snapshot" : false, | |
"lucene_version" : "9.3.0", | |
"minimum_wire_compatibility_version" : "7.17.0", | |
"minimum_index_compatibility_version" : "7.0.0" | |
}, | |
"tagline" : "You Know, for Search" | |
} | |
curl --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 https://localhost:9200 | |
curl -XPUT --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/products?&pretty' | |
curl -XGET --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/_cat/indices?v&pretty' | |
------------ NOT WORKING FOR 8.X ------------------------- | |
curl -XPUT --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/products/mobiles/1?pretty' -H 'Content-Type: application/json' -d' | |
{ | |
"name": "iPhone 7", | |
"camera": "12MP", | |
"storage": "256GB", | |
"display": "4.7inch", | |
"battery": "1,960mAh", | |
"reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"] | |
} | |
' | |
------------ WORKING FOR 8.X ------------------------- | |
curl -XPUT --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/products/_doc/1' -H 'Content-Type: application/json' -d' | |
{ | |
"name": "iPhone 7", | |
"camera": "12MP", | |
"storage": "256GB", | |
"display": "4.7inch", | |
"battery": "1,960mAh", | |
"reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"] | |
} | |
' | |
curl -XPUT --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/products/_doc/3' -H 'Content-Type: application/json' -d' | |
{ | |
"name": "iPhone 7", | |
"camera": "12MP", | |
"storage": "256GB", | |
"display": "4.7inch", | |
"battery": "1,960mAh", | |
"reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"] | |
} | |
' | |
curl -XPUT --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/products/_doc/4' -H 'Content-Type: application/json' -d' | |
{ | |
"name": "iPhone 7", | |
"camera": "12MP", | |
"storage": "256GB", | |
"display": "4.7inch", | |
"battery": "1,960mAh", | |
"reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"] | |
} | |
' | |
curl -XPOST --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/products/_doc' -H 'Content-Type: application/json' -d' | |
{ | |
"name": "iPhone 7", | |
"camera": "12MP", | |
"storage": "256GB", | |
"display": "4.7inch", | |
"battery": "1,960mAh", | |
"reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"] | |
} | |
' | |
curl -XGET --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/products' | |
curl -XGET --cacert /home/elastic/elasticsearch-8.4.2/config/certs/http_ca.crt -u elastic:YrfJHfoQtniJqzyD4pM3 'https://localhost:9200/products/_search?pretty=true&q=*:*' | |
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND