Django

Django 교육 1일차

miin1635@ 2023. 8. 7. 13:55

Pilot Project : 

 

CruzLink 솔루션 거래전문 로그를 수집하고 조회하는 화면 구현

 

log file -> file beat -> elasticsearch (kibana) -> Django->React

 

elastic search terminal 설치 과정 설명 (본인 랩탑에는 putty로 설치) 

 

1.ssh 서버 로그인 (아이피 접속) 

2. elastic search 공식 홈페이지 가이드 https://www.elastic.co/guide/en/elasticsearch/reference/current/targz.html   접속후 쉡 스크립트 작성

 

우리 프로젝트의 구조

1. client와의 통신은 40530 (http 서버) 포트를 이용한다. 

2. 노드 내부 통신 (읽기, 쓰기, replica복제 등등) 은 transport.port 를 사용한다 40531 (private ip) 

3. kibana와 브라우저 간의 통신은 40532 포트를 사용한다 (public ip) 

 

변경해야될 설정 파일들

 1.elastic.yml :  

cluster.name: tuser05

node.name: node-1

http.port: 40530 설정 후 바로 밑줄에 transport.port: 40531

2. jvm.options : #-Xms4g, #-Xmx4g 각각 주석 제거 

 

위의 elastic 설정 후 bin/elasticsearch 명령어로 엘라스틱서치 실행

 

후에 발급되는 enrollment_key 및 id,pwd 메모장에 복사해서 저장해놓기 

ex) 

✅ Elasticsearch security features have been automatically configured!
✅ Authentication is enabled and cluster connections are encrypted.

ℹ️  Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
  yYFRDhNKbSrI3QUT-NRc

ℹ️  HTTP CA certificate SHA-256 fingerprint:
  4f0a7c181b07e45d451a3a2cd9b2d6a0e2cfbb18a2d790e761cc3858ca103f2e

ℹ️  Configure Kibana to use this cluster:
• Run Kibana and click the configuration link in the terminal when Kibana starts.
• Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
  eyJ2ZXIiOiI4LjkuMCIsImFkciI6WyIxLjIzNC4yNS4xMzI6NDA1MzAiXSwiZmdyIjoiNGYwYTdjMTgxYjA3ZTQ1ZDQ1MWEzYTJjZDliMmQ2YTBlMmNmYmIxOGEyZDc5MGU3NjFjYzM4NThjYTEwM2YyZSIsImtleSI6Inh5aW8wb2tCa2UxM3o4eDdIcWRvOl9TS0VIaTVLU3dpMzBXdmFjNjlRbFEifQ==

ℹ️  Configure other nodes to join this cluster:
• On this node:
  ⁃ Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`.
  ⁃ Uncomment the transport.host setting at the end of config/elasticsearch.yml.
  ⁃ Restart Elasticsearch.
• On other nodes:
  ⁃ Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated.

 

3.kibana.yml :  

sever.host : 엘라스틱 서버 ip 

sever.port : Kibana가 통신할 포트번호

후에 bin/kibana 명령어로 키바나 실행 후 발급 받은 enrollment_key 입력 후 configuration 클릭, 

로그인 창이 나타나면 id, pwd 입력

 

4.filebeat.yml : 

hosts:  ["192.168.0.132:40530"],

 

protocol: "https",

 

username 과 password 는 이전에 받은 id pwd 설정 바로 밑줄에 

ssl.verification_node: none 설정! 

 

설정이 모두 완료되면 filebeat test config 및 filebeat test output 진행!

 

 

 

'Django' 카테고리의 다른 글

장고 스터디 확장 (WSGI)  (0) 2023.08.16
Swagger 설치법  (0) 2023.08.14
장고 복습  (0) 2023.08.14
Django 교육 3일차  (0) 2023.08.09
Django 교육 2일차  (0) 2023.08.08