[Linux] ELK 설치 - 1. ElasticSearch 설치

 

ElasticSearch 7.x 설치

ElasticSearch 7.x 패키지를 설치하기 위해 아래 reopository를 /etc/yum.repos.d/elasticsearch.repo 위치에 등록합니다.

(6.x 설치를 원하시면 7을 모두 6으로 수정하시면 됩니다.)

[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

 

yum 명령어를 통해 elasticsearch-oss를 설치합니다.

[root@linux-2 ~]# yum install elasticsearch-oss

 

설치 위치 확인

[root@linux-2 /]# tree /etc/elasticsearch
/etc/elasticsearch
├── elasticsearch.keystore
├── elasticsearch.yml
├── jvm.options
├── jvm.options.d
└── log4j2.properties

1 directory, 4 files

 

서버 메모리가 2GB 밖에 안돼서 heap 사이즈를 조정했습니다

[root@linux-2 elasticsearch]# cat jvm.options| grep Xm
-Xms256m
-Xmx512m

 

elasticsearch 구동 및 부팅시 자동 구동 설정

systemctl start elasticsearch
systemctl enable elasticsearch

 

Listen port 확인

[root@linux-2 elasticsearch]# netstat -lntup | grep java
tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN      1921/java
tcp6       0      0 ::1:9200                :::*                    LISTEN      1921/java
tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN      1921/java
tcp6       0      0 ::1:9300                :::*                    LISTEN      1921/java

 

[root@linux-2 elasticsearch]# curl http://localhost:9200
{
  "name" : "linux-2",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "C9hS_QQoSqGtuwvIIqcrFw",
  "version" : {
    "number" : "7.8.0",
    "build_flavor" : "oss",
    "build_type" : "rpm",
    "build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65",
    "build_date" : "2020-06-14T19:35:50.234439Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

 

index 생성 및 확인

[root@linux-2 elasticsearch]# curl -XPUT http://localhost:9200/customer?pretty
{
  "acknowledged" : true,
  "shards_acknowledged" : true,
  "index" : "customer"
}
[root@linux-2 elasticsearch]# curl -XGET http://localhost:9200/_cat/indices?v
health status index    uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   customer F5VYuuseSjaxOM7zNt7c2g   1   1          0            0       208b           208b

 

댓글

Designed by JB FACTORY

loading