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
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Elastic] Install Elasticsearch through package manager.

Posted on January 14, 2022October 6, 2023 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

Toggle
  • 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
  • Issues
    • curl: (52) Empty reply from server

1) Install Elasticsearch

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
sudo apt-get install apt-transport-https
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.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

Issues

curl: (52) Empty reply from server

The setting xpack.security.enabled in Elasticsearch’s configuration file (elasticsearch.yml) controls the activation of security features. When set to true, it enables security, enforcing authentication and authorization. Conversely, setting it to false disables these security features, allowing unauthenticated access to the Elasticsearch cluster. Changing this setting to false can solve connection issues like the “curl: (52) Empty reply from server” error, but be aware that it makes your Elasticsearch cluster insecure as it allows unauthenticated and unauthorized access.

Nếu bạn dựng không dùng authen gì cả thì fix như sau:

In your elasticsearch.yml file, you might want to change the value of xpack.security.enabled to false. This action could resolve the “curl (52) empty reply from server elasticsearch Ubuntu” error you’re facing​1​​2​​3​.

ELK, Log, Monitor & Tracing

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

[error] Lỗi failed to parse field [host] of type [text] in document with id trên elk ELK
[error] Solve elasticsearch error Limit of total fields [1000] in index [xxx] ELK
[Logstash] Multi config, input, filter, output inside a Logstash server and Not conflict ELK
[OpenVPN] How do you monitor Your OpenVPN-Server via Prometheus and Grafana Grafana
[Prometheus] Relabelling – Đưa thông tin từ Discovered Label sang target label Log, Monitor & Tracing
[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

  • [Azure] The subscription is not registered to use namespace ‘Microsoft.ContainerService’ May 8, 2025
  • [Azure] Insufficient regional vcpu quota left May 8, 2025
  • [WordPress] How to add a Dynamic watermark on WordPress. May 6, 2025
  • [vnet/Azure] VNet provisioning via Terraform. April 28, 2025
  • [tracetcp] How to perform a tracert command using a specific port. April 3, 2025

Archives

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • 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
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.