[Docker]. 도커로 elastic search & kibana 설치하기

jongmin-oh·2022년 11월 10일
0

설치 정보

  • Verson 8.4.2
  • Single Node Setting
  • localhost 에 설치

네트워크 생성

docker network create elastic

도커 이미지 다운로드 & 도커 런

docker run --name es-node01 --net elastic -p 9200:9200 -p 9300:9300 -t docker.elastic.co/elasticsearch/elasticsearch:8.4.2

패스워드 재설정

docker exec -it es-node01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic

패스워드 메모 : Gz-YD7e0hGc*5NsMRjvj

인증서파일 복사

docker cp es-node01:/usr/share/elasticsearch/config/certs/http_ca.crt .

연결 확인

curl --cacert http_ca.crt -u elastic:"<password>" https://localhost:9200

Python client 연결

from elasticsearch import Elasticsearch

# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = "<password>"

# Create the client instance
client = Elasticsearch(
    "https://localhost:9200",
    ca_certs="/path/to/http_ca.crt",
    basic_auth=("elastic", ELASTIC_PASSWORD)
)

# Successful response!
client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}

Kibana Setup

docker run --name kib-01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.4.2

키바나 토큰 생성

docker exec -it es-node01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

토큰 메모:
“eyJ2ZXIiOiI4LjQuMiIsImFkciI6WyIxNzIuMjIuMC4yOjkyMDAiXSwiZmdyIjoiMWViZmQ1NjczZjY2NTZmNWY3Mjc2ZjI0NGI4NjBiOGFlY2MwNDk3NGY0NjZhNDQ0OWZkY2RkYTJiNTc5MDY1ZCIsImtleSI6Ikd4ZVRLNFFCUzA2YlZGVUQ3cUQ5OlpmNjNUZGY4VFoyNExaaW1nV1NxeEEifQ==”

키바나 접속

http://0.0.0.0:5601/?code=888182

위에 메모했던 토큰값 붙여넣기

참고 :

https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-password.html

https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/connecting.html

profile
스타트업에서 자연어처리 챗봇을 연구하는 머신러닝 개발자입니다.

0개의 댓글