Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
    • Helm Chart
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Spinnaker
    • Jenkins
  • Coding
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • Golang
    • Laravel
    • Jquery & JavaScript
    • Git
    • Selenium
  • Log & Monitor
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
  • Toggle search form

[Elastic] Install Elasticsearch through package manager.

Posted on January 14, 2022January 26, 2022 By nim No Comments on [Elastic] Install Elasticsearch through package manager.

Mình cái trên ubuntu 20.04
https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html

Contents

  • 1) Install Elasticsearch
  • 2) Recheck
    • 2.1) Checking port opened
    • 2.2) check status
    • 2.3) check version
  • 3) Config
    • 3.1) Config Ram usage
    • 3.2) Config Cluster name
    • 3.3) Don’t auto update version elastic
    • 3.4) Config to allow network connection
    • 3.5) Config single node

1) Install Elasticsearch

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

sudo apt-get update && sudo apt-get install elasticsearch
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service

2) Recheck

2.1) Checking port opened

thấy port 9200 lên là ok

root@elastic1-u20:~# netstat -ntlpu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      1002/systemd-resolv 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1792/sshd: /usr/sbi 
tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN      26563/java          
tcp6       0      0 ::1:9200                :::*                    LISTEN      26563/java          
tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN      26563/java          
tcp6       0      0 ::1:9300                :::*                    LISTEN      26563/java          
tcp6       0      0 :::22                   :::*                    LISTEN      1792/sshd: /usr/sbi 
udp        0      0 127.0.0.53:53           0.0.0.0:*                           1002/systemd-resolv 

2.2) check status

Kiểm tra sem cài đã ngon nghẻ chưa?

curl -XGET http://localhost:9200/
curl -XGET http://localhost:9200/_cluster/health?pretty

Những điểm cần lưu ý:

status:
– green: là ok
– yellow là warning
– red là Not OK -> elastic của bạn died rồi.

number_of_nodes: trong cluster elastic hiện tại có bao nhiêu node?
number_of_data_nodes: số node chưa data
relocating_shards: đang say ra sự sắp xếp dữ liệu, khi 1 node nào đó bị die
unassigned_shards: có shard nào đó đang bị lỗi và cần rebuild lại.

2.3) check version

Kiểm tra phiên bản nào là mới nhất thời điểm hiện tại.
apt search elasticsearch

3) Config

làm sao để biết config của elastic ở đâu:
cat /lib/systemd/system/elasticsearch.service

cd /etc/elasticsearch/
ll

3.1) Config Ram usage

chỉnh lượng ram elastic sài ở file jvm.options

Bạn để ý thì file config có nhiều “##”. Sau đây chúng ta có 1 command rất hay
grep -v "^#" /etc/elasticsearch/elasticsearch.yml

nó bỏ các dòng có “#” ở đầu và ko hiển thì.

như ảnh ở trên thì ta biết được log và data của elastic lưu ở đâu.

Hiện tại mình đang lab để tìm hiểu về các tính năng nên mình chỉ sửa dụng 1 node elastic.
Nếu có nhu cầu nhiều node.
Mình sẽ note thêm.

3.2) Config Cluster name

Bạn để ý là mình đã thêm cluster.name sàu đó mình:
sudo systemctl restart elasticsearch.service
ls /var/log/elasticsearch/

thấy log ăn theo tên cluster name

cat /etc/passwd

ss -nltpu
Netid  State   Recv-Q  Send-Q        Local Address:Port    Peer Address:Port  Process                                      
udp    UNCONN  0       0             127.0.0.53%lo:53           0.0.0.0:*      users:(("systemd-resolve",pid=1002,fd=12))  
tcp    LISTEN  0       4096          127.0.0.53%lo:53           0.0.0.0:*      users:(("systemd-resolve",pid=1002,fd=13))  
tcp    LISTEN  0       128                 0.0.0.0:22           0.0.0.0:*      users:(("sshd",pid=1792,fd=3))              
tcp    LISTEN  0       4096     [::ffff:127.0.0.1]:9200               *:*      users:(("java",pid=64200,fd=305))           
tcp    LISTEN  0       4096                  [::1]:9200            [::]:*      users:(("java",pid=64200,fd=304))           
tcp    LISTEN  0       4096     [::ffff:127.0.0.1]:9300               *:*      users:(("java",pid=64200,fd=302))           
tcp    LISTEN  0       4096                  [::1]:9300            [::]:*      users:(("java",pid=64200,fd=301))           
tcp    LISTEN  0       128                    [::]:22              [::]:*      users:(("sshd",pid=1792,fd=4))     

3.3) Don’t auto update version elastic

Để ngắn ko tự app upgrade elastic là như sau:

root@elastic1-u20:~# apt-mark hold elasticsearch
elasticsearch set on hold.

3.4) Config to allow network connection

network.host: 0.0.0.0

3.5) Config single node

discovery.type: single-node
ELK, Log & Monitor

Post navigation

Previous Post: [CSS-Font Awesome] Hướng dẫn sử dụng Font Awesome 5 bản miễn phí
Next Post: [Kibana-ELK] Installing and Seting a Kibana For ELK

More Related Articles

[Prometheus] TIP – Custom Prometheus Log & Monitor
[Kibana] Tutorial export and import much data(dashboard,…) in Kibana – ELK ELK
[Kibana-ELK] Installing and Seting a Kibana For ELK ELK
[Grafana] Bar Gause – Vẽ chart Grafana kiểu sóng âm nhạc Grafana
[Logstash] Discovering Pipeline inside Logstash ELK
[Grafana] Hướng dấn tạo Menu Dropdown trên Grafana Grafana

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • Protected: My Assignment  June 24, 2022
  • [Spinnaker] Spinnaker writes too many logs – Reduce spinnaker log level June 22, 2022
  • [Jenkins] Jobs will be created automatically by Jenkins Job Builder June 20, 2022
  • [Postgresql] Install postgresql client and trying a few command postgresql. June 20, 2022
  • [Mount/Nextcloud] How do you mount a hard disk that was used windows into Linux. June 19, 2022

Archives

  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Jenkins
    • Spinnaker
  • Coding
    • Git
    • Golang
    • Jquery & JavaScript
    • Laravel
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kubernetes
      • Ingress
    • Longhorn – Storage
    • Vault
    • VictoriaMetrics
  • Log & Monitor
    • ELK
      • Kibana
      • Logstash
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2022 NimTechnology.