Elastic with ElasticSearch notes
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
http://44.201.203.164:5601/
elastic
gy6qhiWkuJ5S*7dWk83C
Old Architecture - ELK Stack
----------------------------------
Beats --> Logstash --> Elasticsearch <---- Kibana
New Architecture - Elastic Stack
----------------------------------
Agent --> Elasticsearch <---- Kibana < YOU
Infra
Apm
Log == document
Webcr --> -Inverted index (Index(ES)
======================
44.201.203.164
Step 1 - Download the Latest version of Elasticsearch
- https://www.elastic.co/downloads/elasticsearch
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.9.0-linux-x86_64.tar.gz
6 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.9.0-linux-x86_64.tar.gz
7 clear
8 ls
9 tar -zxvf elasticsearch-8.9.0-linux-x86_64.tar.gz
10 pwd
11 clear
12 ls
13 cd elasticsearch-8.9.0
14 ls
15 cd bin
16 ls
17 history
./elasticsearch -d -p pid
=====================================
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
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`):
http://44.201.203.164:5601/
elastic
gy6qhiWkuJ5S*7dWk83C
âšī¸ HTTP CA certificate SHA-256 fingerprint:
bc35253b2805f110990c8b12cd2c53b464219e579de0143dec3a320bb4379a7f
âšī¸ 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):
eyJ2ZXIiOiI4LjkuMCIsImFkciI6WyIxNzIuMzEuODQuNDM6OTIwMCJdLCJmZ3IiOiJiYzM1MjUzYjI4MDVmMTEwOTkwYzhiMTJjZDJjNTNiNDY0MjE5ZTU3OWRlMDE0M2RlYzNhMzIwYmI0Mzc5YTdmIiwia2V5IjoiWklOQ3NZa0JjOFBjQlNlQ0pxNGU6YzFjajVSWnpTby1xTWFFaXhCZmhUUSJ9
âšī¸ 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.
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
CRUD = API
Create - documents
read - documents
Update - documents
Delete - documents
DSL == API
Query
========================
List of Existing Index
curl -XGET --cacert /home/ubuntu/elasticsearch-8.9.0/config/certs/http_ca.crt -u elastic:gy6qhiWkuJ5S*7dWk83C https://localhost:9200/_cat/indices?pretty
Create an Index
curl -XPUT --cacert /home/ubuntu/elasticsearch-8.9.0/config/certs/http_ca.crt -u elastic:gy6qhiWkuJ5S*7dWk83C https://localhost:9200/rajesh112?&pretty
Create a Doc
curl -XPUT --cacert /home/ubuntu/elasticsearch-8.9.0/config/certs/http_ca.crt -u elastic:gy6qhiWkuJ5S*7dWk83C 'https://localhost:9200/rajesh112/_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 -XGET --cacert /home/ubuntu/elasticsearch-8.9.0/config/certs/http_ca.crt -u elastic:gy6qhiWkuJ5S*7dWk83C 'https://localhost:9200/rajesh112/_search?pretty=true&q=*:*'
sudo -s
cd /opt
wget https://artifacts.elastic.co/downloads/kibana/kibana-8.9.0-linux-x86_64.tar.gz
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.9.0-linux-x86_64.tar.gz
tar xzvf elastic-agent-8.9.0-linux-x86_64.tar.gz
cd elastic-agent-8.9.0-linux-x86_64
sudo ./elastic-agent install