elastic install with Docker
Table of contents
es -> kibana
https://www.elastic.co/guide/en/kibana/current/docker.html
Docker image pull (elasticsearch)
1
2
3
4
5
6
7
8
9
docker network create elastic
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.5.3
docker run -d --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.5.3
# Port 9200 is used for all API calls over HTTP. This includes search and aggregations, monitoring and anything else that uses a HTTP request. All client libraries will use this port to talk to Elasticsearch
# Port 9300 is a custom binary protocol used for communications between nodes in a cluster. For things like cluster updates, master elections, nodes joining/leaving, shard allocation
깔끔하게 설치되면 좋겠지만 역시나 몇가지 문제가 발생했다.
발생한 error 1.
- ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
- SOLVED: 공식 설치가이드를 확인하면 최대 map-count를 조정하라는 말이 나온다. https://www.elastic.co/guide/en/elasticsearch/reference/8.2/vm-max-map-count.html
발생한 error 2.
- ERROR: cannot find tty
- SOLVED: https://github.com/docker/for-mac/issues/4822
1
2
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
sysctl -w vm.max_map_count=262144
want to use docker vm ..!
- https://stackoverflow.com/questions/41192680/update-max-map-count-for-elasticsearch-docker-container-mac-host
- 결국 Colima를 사용해 설치완료!
1
2
3
4
5
6
docker version
> OS/Arch: darwin/amd64
Context: colima -> 사용중인 context는 colima(not docker-desktop)
Experimental: true
# 복구는 docker context use default
여기까지 진행했다면,
When you start Elasticsearch for the first time, the following security configuration occurs automatically:
Certificates and keys are generated for the transport and HTTP layers. The Transport Layer Security (TLS) configuration settings are written to elasticsearch.yml. A password is generated for the elastic user. An enrollment token is generated for Kibana.
인 상황
백그라운드 실행시 비번 안보이는 현상
- docker logs 로 다시 봐도 안보임
https://github.com/elastic/elasticsearch/issues/85047
1
2
3
docker exec -ti es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
docker exec -ti es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
pw : pUrzSGapSbFklBWGloQT
enroll token : eyJ2ZXIiOiI4LjUuMyIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiZDQ5YjBmODQ1YzZhMTIxZWVlN2NlYTkyMGMyNTIyNjc4ODYwYTM1NTVkMjJhZTk0ZTVlM2ZkNTExNzkxNzE4MCIsImtleSI6IjZuY3dPWVVCSXktYVU1Y2djcnhTOm9aVXRKVXVJU2ttbDh3dlNlTmJNemcifQ==
Docker image pull (kibana)
1
2
docker pull docker.elastic.co/kibana/kibana:8.5.3
docker run --name kib-01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.5.3
이후 logstash 설치
1
2
docker pull docker.elastic.co/logstash/logstash:8.5.3