아이엠 !나이롱맨😎
article thumbnail
반응형

 

서버는 CentOS7 기준입니다.

 

Elastic Search는 JVM에서 돌아가기 때문에 1.8 이상의 JDK가 설치되어야 합니다. JDK가 정상적으로 설치되었다 가정하게 진행하겠습니다.

 

[STEP1] Elastic Search repo 파일 생성

$ vi /etc/yum.repos.d/elasticsearch.repo

repo 파일을 생성 후 elasticsearch.repo에 아래와 같은 내용을 적습니다.

 

* 참고 : yum이 아닌 tar.gz 로 다운받고 싶으신 분들은 아래 링크를 확인하시기 바랍니다.

 

Install Elasticsearch from archive on Linux or MacOS | Elasticsearch Guide [7.14] | Elastic

Typically, any cluster-wide settings (like cluster.name) should be added to the elasticsearch.yml config file, while any node-specific settings such as node.name could be specified on the command line.

www.elastic.co

 

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

[STEP2] yum으로 설치

$ yum install -y elasticsearch

명령어 뒤에 버전을 명시하지 않으면 최신버전으로 설치됩니다. 버전을 명시하려면 아래와 같이 하면 됩니다.

 

$ yum install -y elasticsearch-7.13.4

 설치를 하게되면 아래와 같은 디렉터리가 생깁니다.

 

home dir : /usr/share/elasticsearch
config dir : /etc/elasticsearch
data dir : /var/lib/elasticsearch
log dir : /var/log/elasticsearch


[STEP3] 서비스 등록

$ sudo systemctl enable elasticsearch
$ sudo systemctl start elasticsearch

 

[FINAL STEP] 설치 확인

 

위와 같이 서비스로 시작하는 것도 가능하고, /usr/share/elasticsearch/bin 으로 이동 후 아래 명령어를 입력한 후 Elastic Search를 실행시키기는 것도 가능합니다.

$ ./elasticsearch

 

만약 에러가 뜬다면 아래 글을 참조하시길 바랍니다.

 

[ElasticSearch] org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

Elasticsearch 5.0 이후에서는 root에서 elasticsearch를 실행할 수 없게 했기 때문에 sudo 명령어를 사용한다고 Elasticsearch를 실행 할 수 없습니다. 계정을 새로 생성 한 후 권한을 부여하여 그 계정으로 실.

kingofbackend.tistory.com

 

실행한 후 아래와 같이 합니다. localhost 대신 서버 ip를 입력해줍니다.

$ curl -X GET 'localhost:9200'

입력 후 아래와 같이 나온다면 정상적으로 설치되었습니다.

 

{
  "name" : "es-install-test",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "6IfgGaPUHTHu_JfzfEgRVw",
  "version" : {
    "number" : "7.6.0",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "7f634e9f12345fbc12721234dd1da681b0c3b1e3",
    "build_date" : "2020-02-06T00:09:00.449973Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

 

반응형

article prev thumbnail
article next thumbnail
profile on loading

Loading...