DOCKER CONTAINER ELK STACK 세팅하기

code_able·2023년 10월 16일
0
post-custom-banner

elk stack을 위한 네트워크 생성

sudo docker network create elk-stack-net

elasticsearch 세팅

pull image

sudo docker pull docker.elastic.co/elasticsearch/elasticsearch:7.14.1

container 실행

sudo docker run -d \
-p 9200:9200 -p 9300:9300 \
-v data:/usr/share/elasticsearch/data \
-v logs:/usr/share/elasticsearch/logs \
-e "discovery.type=single-node" \
-e TZ=Asia/Seoul \
--name elasticsearch \
--network elk-stack-net \
docker.elastic.co/elasticsearch/elasticsearch:7.14.1

elasticsearch는 127.0.0.1에 바인딩 되어 있어서 외부 접근 필요 시
아래의 세팅을 필요로 함

sudo docker exec -ti elasticsearch-container /bin/bash
apt-get update
apt-get install vim
vi /etc/elasticsearch/elasticsearch.yml
------------------------------------------------
network.host:0.0.0.0
discovery.seed.hosts: ['0.0.0.0']
------------------------------------------------

형태소 분석기 nori plugin

sudo docker exec -ti elasticsearch-container /bin/bash
bin/elasticsearch-plugin install analysis-nori
sudo docker restart elasticsearch-container

인증설정

sudo docker exec -ti elasticsearch-container /bin/bash

vi config/elasticsearch.yml
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

sudo docker restart elasticsearch-container

bin/elasticsearch-setup-passwords interactive

kibana 세팅

pull image

sudo docker pull docker.elastic.co/kibana/kibana:7.14.1

container 실행

sudo docker run -d \
-p 5601:5601 \
-e "ELASTICSEARCH_HOSTS=http://elasticsearch:9200" \
-e "ELASTICSEARCH_USERNAME=elastic" \
-e "ELASTICSEARCH_PASSWORD=elastic" \
--name kibana \
--network elk-stack-net \
docker.elastic.co/kibana/kibana:7.14.1

logstash 세팅

pull image

sudo docker pull docker.elastic.co/logstash/logstash:7.14.1

container 실행

sudo docker run -d \
-p 5044:5044 \
--name logstash \
--network elk-stack-net \
docker.elastic.co/logstash/logstash:7.14.1

reference

profile
할수 있다! code able
post-custom-banner

0개의 댓글