docker 를 이용하면 로컬에서 간단하게 elaticsearch 와 kibana 를 실행할 수 있다.
// dokcer-compose.yml
services:
ma:
build:
context: ./my-api
dockerfile: ../Dockerfile.ma
environment:
- NODE_ENV=development
- PORT=9443
- DB_NAME=database
- DB_HOST=db
- DB_PORT=3306
- DB_USER=root
- DB_PASSWORD=1234
- ELASTICSEARCH_HOST=http://es:9200 # ELASTICSEARCH_HOST 추가
ports:
- "9443:9443"
depends_on:
- db
- es
es:
image: docker.elastic.co/elasticsearch/elasticsearch:8.4.3
environment:
- node.name=es
- discovery.type=single-node # single-node 로 만든다.
- discovery.seed_hosts=es
- ELASTIC_PASSWORD=ecubelabs
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- xpack.security.http.ssl.enabled=false
- xpack.security.http.ssl.verification_mode=certificate
- xpack.security.transport.ssl.enabled=false
- xpack.security.transport.ssl.verification_mode=certificate
- xpack.license.self_generated.type=basic
mem_limit: 1073741824
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test:
[
"CMD-SHELL",
"curl -s --cacert config/certs/ca/ca.crt http://localhost:9200 | grep -q 'missing authentication credentials'",
]
interval: 10s
timeout: 10s
retries: 120
volumes:
- es-data:/usr/share/es/data
- certs:/usr/share/elasticsearch/config/certs
ports:
- 9200:9200
kibana:
image: docker.elastic.co/kibana/kibana:8.4.3
environment:
- ELASTICSEARCH_HOSTS=http://es:9200
ports:
- 5601:5601
depends_on:
- es
volumes:
certs:
driver: local
es-data:
driver: local
로컬에서 실행할 것이기 때문에 security 관련 설정은 false
로 한다.
xpack.security.enabled=false
xpack.security.http.ssl.enabled=false
xpack.security.transport.ssl.enabled=false
docker compose up --build es kibana