du.study기록공간

CentOS, Elasticsearch 6.x Install 본문

DB

CentOS, Elasticsearch 6.x Install

du.study 2020. 3. 4. 10:16
728x90

이번엔 간략하게 ES를 설치하는 과정과 그 과정에서 발생한 이슈를 기록해놓으려 합니다.

 

Elasticsearch 관련 설치는 너무 가이드가 잘되어있어서 사실 따로 쓸게 없지만... 그래도 설치과정에서 이슈가 있었으니 간략하게 기록하려합니다.

 

 

먼저 CentOS에서 OpenJDK를 설치했습니다.(8버전 이상)

$ yum list java*jdk-devel


Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
Installed Packages
java-1.8.0-openjdk-devel.x86_64                                                        1:1.8.0.141-1.b16.el7_3                                                            @updates
Available Packages
java-1.6.0-openjdk-devel.x86_64                                                        1:1.6.0.41-1.13.13.1.el7_3                                                         updates
java-1.7.0-openjdk-devel.x86_64                                                        1:1.7.0.141-2.6.10.1.el7_3                                                         updates
java-1.8.0-openjdk-devel.i686                                                          1:1.8.0.141-1.b16.el7_3

$ yum install java-1.8.0-openjdk-devel.x86_64

 

 

 

 

Elastissearch 설치 자체는 간단하게 할 수 있습니다.

 

https://www.elastic.co/guide/en/elasticsearch/reference/6.8/install-elasticsearch.html

 

Installing Elasticsearch | Elasticsearch Reference [6.8] | Elastic

Installing Elasticsearchedit Hosted Elasticsearchedit Elasticsearch can be run on your own hardware or using our hosted Elasticsearch Service on Elastic Cloud, which is available on AWS and GCP. You can try out the hosted service for free. Installing Elast

www.elastic.co

에서 나와있다 싶이 간단하게 zip파일을 다운받고 해제하여 바로 사용이 가능하게끔 지원해줍니다.

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.6.zip
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.6.zip.sha512
shasum -a 512 -c elasticsearch-6.8.6.zip.sha512 
unzip elasticsearch-6.8.6.zip
cd elasticsearch-6.8.6/ 

 

하지만~ 저는 rpm을 이용하여 설치하기로 했습니다. 

# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.1-x86_64.rpm
# rpm -i elasticsearch-6.6.1.rpm

# systemctl enable elasticsearch.service
# service elasticsearch start
(# service elasticsearch stop)

# 경로를 변경했을경우.(bin 경로)
 /usr/lib/systemd/system/elasticsearch.service에서 수정


해당 설치를 마치고 curl localhost:9200을 호출해보면 일반적인 응답이 노출되는것을 확인할 수 있습니다.

# curl localhost:9200

{
  "name" : "ttttttN",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "uuuuuuuuuuuuuuuuuuu-22",
  "version" : {
    "number" : "6.6.1",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "1fd8f69",
    "build_date" : "2019-02-13T17:10:04.160291Z",
    "build_snapshot" : false,
    "lucene_version" : "7.6.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

 

 

 

rpm으로 설치한 이유로는 해당 페이지에 맨아래에있는 Directory layout와 service 실행과 관련이 있습니다.

https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html

 

Install Elasticsearch with RPM | Elasticsearch Reference [7.6] | Elastic

On systemd-based distributions, the installation scripts will attempt to set kernel parameters (e.g., vm.max_map_count); you can skip this by masking the systemd-sysctl.service unit.

www.elastic.co

zip 파일 설치의 경우, 압축을 푼 해당 폴더가 home directory로 적용이 되지만.. 현재 저희는 elasticsearch 에서 제공해주는 default폴더를 사용중이기도 하고, rpm 설치를 통해 간단하게 service로 사용할 수 있어서 zip대신 설치하였습니다.

 

 

너무 가이드가 잘되어있었으나.. 사실 설치중 이슈를 적어보고자 해당 글을 적습니다.

 

첫 번째 이슈
/var/log/elasticsearch/gc.log due to Permission denied

 

맨처음 service실행 방법이 아닌 bin 폴더에서 ./elasticsearch -d 를 root권한으로 실행....

elasticsearch의 경우 root실행을 지원하지 않지만. 해당 실행을 하게되면 각종 로그들이 root로 생성이 됩니다.

그 이후에 service를 통해 구동시, root권한의 로그들을 잃지 못하는 이슈가 발생합니다.

 

해결법 

권한을 elasticsearch로 수정해줍니다!( service에서 user를 변경하지않았다면..!)

 

 

두 번째 이슈
Caused by: java.nio.file.AccessDeniedException: /data01/elasticsearch/data/nodes

 

프로젝트 path.data를 조정하였는데.. 접근할 수 없다는 로그...! 

이것또한 service를 실행시, elasticsearch user 권한으로 들어가는데, 폴더를 root로 생성한다음 구동하여 발생..

 

세 번째 이슈

curl localhost:9200은 되는데 어째서 curl ip:9200 은 되지않는가..!! 라는 멍청한 삽질을 하다가 세팅을 안해줬다는걸 깨달았다..

/etc/elasticsearch/elasticsearch.yml 파일에서 network.host 이랑 port 수정!! 으로 정상동작을 확인했습니다.

728x90

'DB' 카테고리의 다른 글

Elasticsearch heap memory setting  (0) 2020.03.06
MongoDB sharding Architecture  (0) 2019.11.15
Comments