# 압축파일 다운로드
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.7.1-linux-x86_64.tar.gz
# 압축 풀기
tar -xzf elasticsearch-8.7.1-linux-x86_64.tar.gz
# 폴더 이동
cd elasticsearch-8.7.1/
# 프론트에서 실행
./bin/elasticsearch
# 백그라운드에서 실행
./bin/elasticsearch -d
# 백그라운드에서 실행, pid 저장
./bin/elasticsearch -d -p pid
# elasticsearch 종료
pkill -F pid
비밀번호 생성(옵션) - elasticsearch가 켜져있을 때 실행해야 된다.
# 랜덤으로 생성
bin/elasticsearch-reset-password -u elastic
# 스스로 설정
bin/elasticsearch-reset-password -u elastic -i
# 비밀번호 환경변수 선언
export ELASTIC_PASSWORD="your_password"
인증절차를 무시하고 싶다면 elasticsearch를 한번 실행했다가 끈 후
/config/elasticsearch.yml 파일을 다음과 같이 4개의 요소를 true -> false로 변경
xpack.security.enabled: false
xpack.security.enrollment.enabled: false
xpack.security.http.ssl:
enabled: false
xpack.security.transport.ssl:
enabled: false
환경번수에 주의하자 $ES_HOME 변수를 설정해두었다면 다음 그대로 실행
# 인증절차 있다면
curl --cacert $ES_HOME/config/certs/http_ca.crt -u elastic https://localhost:9200
# 비밀번호 한번에 입력(ES_PASSWORD 환경변수 설정 필요)
curl --cacert $ES_HOME/config/certs/http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200
# 인증절차 없다면
curl -XGET localhost:9200