티스토리 뷰

안녕하세요 tommy 입니다. 

 

1. 도커버전 20.10.11 버전이네요.

Windows 기반 power shell 에서 간단히 Docker test 진행해보겠습니다. 

PS C:\Users\tommy> docker -v
Docker version 20.10.11, build dea9396

 

2. 먼저 도커 에서 다운로드 진행 합니다. 

#docker pull docker.elastic.co/elasticsearch/elasticsearch:7.6.2

 

3. 다운된 이미지 확인

#PS C:\Users\tommy> docker images

 

 

4. Elasticsearch container구동

PS C:\Users\tommy> docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.6.2
d9a9eb4f7612d59cf46d8a294cef5f2f2d8be7a542fc877de49cf046295b5bfc

1) 프로세스 확인

PS C:\Users\tommy> docker ps -a
CONTAINER ID   IMAGE                                                 COMMAND                  CREATED             STATUS                         PORTS                                            NAMES
d9a9eb4f7612   docker.elastic.co/elasticsearch/elasticsearch:7.6.2   "/usr/local/bin/dock…"   27 seconds ago      Up 26 seconds                  0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   elasticsearch

2) 설치테스트 확인

5. Kibana이미지 다운로드

docker pull docker.elastic.co/kibana/kibana:7.6.2

1. 이미지 확인

2. 기존 elasticsearch 컨테이너 중지 및 삭제

PS C:\Users\tommy> docker stop elasticsearch
elasticsearch
PS C:\Users\tommy>  docker rm elasticsearch
elasticsearch

혹여 나에러가 발생하여  이렇게 대처 하면 되겠습니다. 
컨테이너가 종료되면 여전히 도커 시스템에 있습니다.
제거할 때까지 사용자가 지정한 이름이 사용되며 다른 컨테이너에 사용할 수 없습니다.
명령을 사용하여 중지된 컨테이너를 제거할 수 있습니다.

docker container prune 
또는 볼륨, 네트워크 등도 정리하려는 경우 다음을 수행할 수 있습니다.

docker system prune
PS C:\Users\tommy> docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
bdb34781152f2d5dc639164d33d5f0a7c37d1bf0c7073a64c20da926cf97d315
8d98ca4bb6e08c9062c375a110ec15615203b15f2a4fa0d284b8acfe002b7741
d432ef9c1133fff26160261b7958f6d3f4e35bb4e4341bb1e6260753ef3b03a2
f272cec26f7ff453ee9cce92e7c535797c5d8cf99f0f8f50071f77ce813702b2

Total reclaimed space: 1.131kB
PS C:\Users\tommy> docker system prune
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N] y
Deleted Networks:
es_opensearch-net

Deleted build cache objects:
s9fjgey11vah7cif25h9cx5qq
u78lgfancmu25zz9w9ybtk6af
0nld3rklximdd1n0bgavtxfwm
1qwe03rsh4w0pmp4fu5mp1v16
kyn8znlfgnf10ldblp592uljy
ab0hthx1qflz8bqzwuin5e50b
r6g12j55ak9p592a7cq9qrnez
aal10k6lwc0y9eb4tpcg6movk
ufx1d7ep2fumg6osmkeo7rcow
r5dyl9czmvisrgiqcipgt5cb5
hd3xb6uewotyfqakkhog1w48c
pkcmb6vpmohd5jxjmrllenfmj
r7yapksi6ugszbdn2qpkkr9hh
9inq4ckajvlrwbciuxhi680j9
jjhwud7ha7rlda4db5nofwxs6
bc689nhl02uuib9s1fa26yk2i
zh2baczw7huqk06m9g7f8ad00
fz007gdffh63mylfurhdx5ng8
uwvk7dubs5yf5tugz4fl59b4m
8fcgo6ar94r2mf0tw8se4994t
90mxlg8br6y1xmxtt4d6lhphx
v058bmf28m8rnjt7347la94ol
zhm3ew7utjzx1cfzhuvc8jwzu

Total reclaimed space: 85.49MB

3. docker 네트워크 추가 및 확인

PS C:\Users\tommy> docker network create elastic
a7cced442befb96a05c49813e91d13d0618ba2c228c550b1ee780cf6219c823f


PS C:\Users\tommy> docker network ls
NETWORK ID     NAME                DRIVER    SCOPE
06bebc76a739   bridge              bridge    local
a7cced442bef   elastic             bridge    local
559f517be0af   es_opensearch-net   bridge    local
cf76394785ac   host                host      local
8920e02543df   none                null      local

6. Elasticsearch 컨테이너 추가 및 구동

PS C:\Users\tommy> docker run -d --network=elastic --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.6.2
771a279849860aea0ce1325a6993cb1b83ebc97131e8a1acf00a9c85981c6582

PS C:\Users\tommy> docker ps
CONTAINER ID   IMAGE                                                 COMMAND                  CREATED          STATUS          PORTS                                            NAMES
771a27984986   docker.elastic.co/elasticsearch/elasticsearch:7.6.2   "/usr/local/bin/dock…"   49 seconds ago   Up 46 seconds   0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   elasticsearch
27d3d63c0a67   opensearchproject/opensearch-dashboards:latest        "./opensearch-dashbo…"   2 hours ago      Up 2 hours      0.0.0.0:5601->5601/tcp                           opensearch-dashboards
PS C:\Users\tommy>

7. Logstash 이미지 다운

PS C:\Users\tommy> docker pull docker.elastic.co/logstash/logstash:7.6.2

 1) logstash config설정

c:드라이브에 /root/apps/logstash/logstash.conf 파일을 생성해봅니다.



input {
  beats {
    port => 5044
  }
}
output {
  elasticsearch {
    hosts => ["elasticsearch:9200"]
    user => elastic
    password =>changeme
    manage_template => false
    index => "access-log" 
    document_type => 
  }
}

2. logstash 컨테이너 구동

PS C:\Users\tommy>  docker run -d --name logstash --network elastic -p 5044:5044 -v C:\root\apps\logstash\logstash.conf:/usr/share/logstash/pipeline/logstash.conf docker.elastic.co/logstash/logstash:7.6.2
8d98ca4bb6e08c9062c375a110ec15615203b15f2a4fa0d284b8acfe002b7741


PS C:\Users\tommy>

3. kibana 컨테이너 추가 및 구동

PS C:\Users\tommy> docker run -d --network=elastic --name kibana -p 5601:5601 docker.elastic.co/kibana/kibana:7.6.2
3d50b58789ebaea8bd477cf0dd965f44ec5044565b72f4d663343ea2cb20ca97


PS C:\Users\tommy> docker ps
CONTAINER ID   IMAGE                                                 COMMAND                  CREATED          STATUS          PORTS                                            NAMES
3d50b58789eb   docker.elastic.co/kibana/kibana:7.6.2                 "/usr/local/bin/dumb…"   10 seconds ago   Up 8 seconds    0.0.0.0:5601->5601/tcp                           kibana
771a27984986   docker.elastic.co/elasticsearch/elasticsearch:7.6.2   "/usr/local/bin/dock…"   27 minutes ago   Up 27 minutes   0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   elasticsearch

8. Filebeat이미지다운 및 Filebeat config설정

PS C:\Users\tommy>  docker pull docker.elastic.co/beats/filebeat:7.6.2
7.6.2: Pulling from beats/filebeat
c808caf183b6: Already exists
c5d26ebed11d: Pull complete
2b0a2e030582: Pull complete
ffde1e12d35a: Pull complete
4503b4f6065d: Pull complete
1e67ef889e4e: Pull complete
d845627f6df4: Pull complete
Digest: sha256:24211654fbe1ce3866583d7ae385feffbfaa77d4598d189fdec46111133811a9
Status: Downloaded newer image for docker.elastic.co/beats/filebeat:7.6.2
docker.elastic.co/beats/filebeat:7.6.2
PS C:\Users\tommy>
c:/root/apps/filebeat

c:/root/apps/filebeat/filebeat.yml 파일 생성후 아래 내용 입력


filebeat.prospectors:
- input_type: log
  paths:
    - /usr/share/filebeat/logs/access_log
output:
  logstash:
    hosts: ["logstash:5044"]

1. filebeat 컨테이너 실행

PS C:\Users\tommy>  docker run -d --name filebeat --network elastic -v /apps/filebeat/test.log:/usr/share/filebeat/logs/access_log docker.elastic.co/beats/filebeat:7.6.2
9ed9f24133b3db3a6f815551f9b61e985e21eeae9a00a5c09ee319af70be9143
PS C:\Users\tommy>

 

 

9. 웹화면에 접속하여 잘 기동 되는지 확인합니다. [로컬 아이피는 172.19.160.1 이네요 ]

웹브라우저에서 http://172.19.160.1:5601


[다크쉐라빔의 주절주절]의 블로그 참조 하였으며, 
window 환경에서 셋팅 해보았습니다. 

 

감사합니다. ^^

댓글