일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 방이편백육분삼십성신여대
- 방이편백육분삼십
- npm
- 스페인여행
- 통영에어비앤비
- 통영
- react
- gradle
- 통영여행
- 한남동맛집
- JavaScript
- 뚝섬역맛집
- 성신여대맛집
- 서울숲누룽지통닭구이
- 파이썬
- 성신여대편백집
- 퇴사후공무원
- 영화추천
- 국가직
- springboot
- 한성대맛집
- 자바스크립트에러처리
- 돈암동맛집
- tomcat7
- ubuntu자바설치
- ELK
- 통영예쁜카페
- 공무원
- 성북구맛집
- 꼴뚜기회
- Today
- Total
코린이의 기록
[Elasticsearch] CentOS elasticsearch 설치 및 실행하기 본문
prerequisite
- Java 8 이상 권장
RPM 으로 설치하기
1. Download
(*현 시점에서는 elasticsearch version이 7.0.0입니다. 이는 추후에 변경될 수 있습니다.)
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.0.0-x86_64.rpm
직접 받아도됨 : https://www.elastic.co/kr/downloads/elasticsearch
2. 설치
$ rpm -ivh elasticsearch-oss-7.0.0-x86_64.rpm
* 꼭 알아두기!
Install path : /usr/share/elasticsearch
config file path : /etc/elasticsearch
Init script path : /etc/init.d/elasticsearch
3. Elasticsearch service 시작&중지
$ sudo systemctl enable elasticsearch.service
$ sudo service elasticsearch start
$ sudo service elasticsearch stop
4. Elasticsearch service 확인
: Elasticsearch가 localhost에서 제대로 run 했는지 확인한다.
$ curl -XGET 'localhost:9200'
[sy.yoon@rusdev ~]$ curl -XGET localhost:9200
{
"name" : "rusdev",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "eAhWxkPYTeG5aHxF9RksqA",
"version" : {
"number" : "7.0.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "b7e28a7",
"build_date" : "2019-04-05T22:55:32.697037Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.7.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Linux 로 설치하기
1. Download
https://www.elastic.co/kr/downloads/elasticsearch 에서 elasticsearch-7.0.0-linux-x86_64.tar.gz를 다운로드 한다.
2. 압축을 푼다.
$ tar -xvf elasticsearch-7.0.0-linux-x86_64.tar.gz
3. 실행
$ cd elasticsearch-7.0.0
$ bin/elasticsearch
4. Elasticsearch service 확인
: Elasticsearch가 localhost에서 제대로 run 했는지 확인한다.
$ curl -XGET 'localhost:9200'
[sy.yoon@rusdev ~]$ curl -XGET localhost:9200
{
"name" : "rusdev",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "eAhWxkPYTeG5aHxF9RksqA",
"version" : {
"number" : "7.0.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "b7e28a7",
"build_date" : "2019-04-05T22:55:32.697037Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.7.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
여기까지가 설치 과정임
RPM으로 설치한 후 elasticsearch를 실행하니 아래와 같은 error가 발생함.
결국 해결은 못해서 재설치함 ..
만약 'curl: (7) : Failed connect to localhost:9200; 연결이 거부됨' 과 같은 Error가 발생할 경우, 다음과 같은 명령어로 원인을 확인한다.
$ systemctl status elasticsearch
Case 1
[root@rusdev ~]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 금 2019-04-26 14:21:50 KST; 7s ago
Docs: http://www.elastic.co
Process: 170391 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 170391 (code=exited, status=1/FAILURE)
4월 26 14:21:47 rusdev elasticsearch[170391]: 2019-04-26 14:21:47,738 main ERROR Null object return...rs.
4월 26 14:21:47 rusdev elasticsearch[170391]: 2019-04-26 14:21:47,739 main ERROR Null object return...rs.
4월 26 14:21:47 rusdev elasticsearch[170391]: 2019-04-26 14:21:47,739 main ERROR Null object return...rs.
4월 26 14:21:47 rusdev elasticsearch[170391]: 2019-04-26 14:21:47,739 main ERROR Unable to locate a...ot"
4월 26 14:21:47 rusdev elasticsearch[170391]: 2019-04-26 14:21:47,739 main ERROR Unable to locate a...ex"
4월 26 14:21:47 rusdev elasticsearch[170391]: 2019-04-26 14:21:47,740 main ERROR Unable to locate a...og"
4월 26 14:21:47 rusdev elasticsearch[170391]: 2019-04-26 14:21:47,740 main ERROR Unable to locate a...on"
4월 26 14:21:50 rusdev systemd[1]: elasticsearch.service: main process exited, code=exited, status...LURE
4월 26 14:21:50 rusdev systemd[1]: Unit elasticsearch.service entered failed state.
4월 26 14:21:50 rusdev systemd[1]: elasticsearch.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
Case 2
systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 금 2019-04-26 16:07:28 KST; 28s ago
Docs: http://www.elastic.co
Process: 189956 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 189956 (code=exited, status=1/FAILURE)
4월 26 16:07:28 rusdev systemd[1]: Started Elasticsearch.
4월 26 16:07:28 rusdev elasticsearch[189956]: 오류: 기본 클래스 org.elasticsearch.tools.java_version_checker.Ja…습니다.
4월 26 16:07:28 rusdev systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
4월 26 16:07:28 rusdev systemd[1]: Unit elasticsearch.service entered failed state.
4월 26 16:07:28 rusdev systemd[1]: elasticsearch.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@rusdev elasticsearch-head]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 금 2019-04-26 16:07:28 KST; 25min ago
Docs: http://www.elastic.co
Process: 189956 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 189956 (code=exited, status=1/FAILURE)
4월 26 16:07:28 rusdev systemd[1]: Started Elasticsearch.
4월 26 16:07:28 rusdev elasticsearch[189956]: 오류: 기본 클래스 org.elasticsearch.tools.java_version_checker.JavaVersionChecker을(를) 찾거나 로드할 수 없습니다.
4월 26 16:07:28 rusdev systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
4월 26 16:07:28 rusdev systemd[1]: Unit elasticsearch.service entered failed state.
4월 26 16:07:28 rusdev systemd[1]: elasticsearch.service failed.
[root@rusdev elasticsearch-head]#
Case 3
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 목 2019-05-02 16:29:04 KST; 1h 26min ago
Docs: http://www.elastic.co
Process: 40233 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs=${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE)
Process: 40231 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 40233 (code=exited, status=1/FAILURE)
5월 02 16:29:00 rusdev systemd[1]: Starting Elasticsearch...
5월 02 16:29:00 rusdev systemd[1]: Started Elasticsearch.
5월 02 16:29:04 rusdev systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
5월 02 16:29:04 rusdev systemd[1]: Unit elasticsearch.service entered failed state.
5월 02 16:29:04 rusdev systemd[1]: elasticsearch.service failed.
bash -x elasticsearch
[root@rusdev bin]# bash -x elasticsearch
++ dirname elasticsearch
+ source ./elasticsearch-env
++ set -e -o pipefail
++ CDPATH=
++ SCRIPT=elasticsearch
++ '[' -h elasticsearch ']'
+++ dirname elasticsearch
++ ES_HOME=.
+++ cd .
+++ pwd
++ ES_HOME=/usr/share/elasticsearch/bin
+++ basename /usr/share/elasticsearch/bin
++ '[' bin '!=' bin ']'
+++ dirname /usr/share/elasticsearch/bin
++ ES_HOME=/usr/share/elasticsearch
++ ES_CLASSPATH='/usr/share/elasticsearch/lib/*'
++ '[' '!' -z /usr/lib/jvm/jdk1.8.0_191 ']'
++ JAVA=/usr/lib/jvm/jdk1.8.0_191/bin/java
++ '[' '!' -x /usr/lib/jvm/jdk1.8.0_191/bin/java ']'
++ '[' '!' -z '' ']'
++ '[' '!' -z '' ']'
++ /usr/lib/jvm/jdk1.8.0_191/bin/java -cp '/usr/share/elasticsearch/lib/*' org.elasticsearch.tools.java_version_checker.JavaVersionChecker
오류: 기본 클래스 org.elasticsearch.tools.java_version_checker.JavaVersionChecker을(를) 찾거나 로드할 수 없습니다.