Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[메뉴얼] Circuitbreaker #13

Open
4whomtbts opened this issue Sep 18, 2021 · 1 comment
Open

[메뉴얼] Circuitbreaker #13

4whomtbts opened this issue Sep 18, 2021 · 1 comment
Assignees

Comments

@4whomtbts
Copy link
Contributor

4whomtbts commented Sep 18, 2021

프로그램 설명

서버 컴퓨터의 하드웨어(CPU, GPU) 의 온도가 일정 이상을 넘어갈때, 해당 서버의 컨테이너를 종료한다

지원기능

  1. CPU, GPU 가 설정이상의 온도로 넘어갈 시 컨테이너 종료(Circuitbreaking) 및 알림 메일 발송
  2. 서버내의 온도 모니터링 SW(node_exporter, dcgm_exporter)
  3. Master 에 장착되어있는 온도계를 활용하여 현재 서버실의 대기온도 및 습도감시

사용설명

Master-Peer 구조로 구성되어있음

  1. Master
  • 관리하는 Node 들에, 모니터링 SW 정상작동 여부 요청 및 Circuitbreaking 실행 트리거
  1. Node(==Peer)
  • 장비에 설치되어 있는 모니터링 SW 의 정상작동 여부 확인
  • 장비의 CPU, GPU 온도감시 및 최대값 초과시 컨테이너 자동 중지

운영방법

Master 는 과열발생의 우려가 없는 별도의 서버 및 노트북에 설치해야하며
현재는 노트북에 장착되어있는 전자온도계(2021.09.18 기준) 도 장착해야한다.
Node 는 온도감시가 필요한 서버에 설치해야한다.

설정

Node 설정

# Node 를 식별하기 위한 이름이며, 메일 전송시에 노드의 이름으로 사용됨 
nodeName: server1
# Node 의 타입을 의미하며, Master 인 경우 master, Node 인 경우 node
type: node
# Node 가 외부에 노출할 포트
port: 5000

# 서버에서 동작하고 있는 모니터링 SW 들을 명시하며
# 현재 node_exporter, dcgm_exporter 만 지원한다
# 어떠한 exporter 를 사용할지는 label 에 명시되어있다.
exporters:
  - name: node_exporter
    label: node_exporter
    url: http://localhost:9100/metrics
    config:
      # 허용가능한 최대 CPU 온도
      maxCpuTemp: 90
     # 삭제예정
      mailIntervalSec: 9999
  - name: dcgm_exporter
    label: dcgm_exporter
    url: http://localhost:9400/metrics
    config:
      # 허용가능한 최대 GPU 온도
      maxGpuTemp: 90
     # 삭제예정
      mailIntervalSec: 9999

Master 설정

nodeName: 마스터 서버
type: master
port: 5000

# 허용할 연구실의 최대 대기온도(섭씨)
maxTemperature: 25
# 모든 감시중인 Node의 모니터링 SW(node_exporter, dcgm_exporter)의 정상동작 여부확인의 간격임 [초 단위]
healthCheckIntervalSec: 43200
# 모든 감시중인 Node의 서킷브레이커 작동 여부확인의 간격임 [초 단위]
circuitBreakerIntervalSec: 300

# 메일 발신계정의 email 이며 gmail 계정만 가능함
# 특별한 이유가 없다면 [email protected] 을 사용해야하지만
# 다른 계정으로 바꾸고자할때는 https://jinseongsoft.tistory.com/294 를 참고하여 gmail 계정의 보안설정을 진행해야한다.
email: [email protected]
# 메일 발신계정의 password 임
emailPassword: ***
# 모니터링 SW 정상작동 확인 레포트 및 서킷브레이커 발동여부를 받을 이메일 수신자들의 리스트이다
emailReceivers:
  - [email protected]
  - [email protected]

# 감시할 각 노드의 엔드포인트이다.
# http://<Node 의 IP>:<Node 설정에서의 port> 로 구성되며, 만약에 해당 엔드포인트가 NAT 를 통해 노출되어 있다면
# NAT RULE 의 http://IP:PORT 를 통해서 노출해야 함. 
nodes:
  - http://192.168.1.11:5000
  - http://192.168.1.12:5000
  - http://192.168.1.13:5000
  - http://192.168.1.14:5000
  - http://192.168.1.15:5000
  - http://192.168.1.16:5000
  - http://192.168.1.17:5000

배포방법

[주의] 반드시 Node 를 모두 배포한 후 Master 를 배포해야함!

준비사항

  1. unix 계열 시스템(linux, macOS)
  2. go v.1.17 설치
  3. ssh key 가 교환된 sudoer 계정
  4. script/deploy.sh 에서 emailPassword 를 실제 패스워드로 변경

프로그램은 레포지터리 에 있음

$ git clone https://github.com/DGU-AILab/Circuitbreaker
$ ./script/build.sh

  1. Node 배포시
    $ ./script/deploy.sh IP PORT NODE이름(띄어쓰기X) SUDOER계정
    (eg: ./script/deploy.sh 210.94.223.123 8086 6번서버 4whomtbts)

  2. Master 배포시
    $ ./script/deploy.sh IP PORT NODE이름(띄어쓰기X) SUDOER계정 master
    (eg: ./script/deploy.sh 210.94.223.123 8086 6번서버 4whomtbts master)

배포성공여부 확인

  1. 확인하고자 하는 node(master 포함) 에 ssh 로 접속한다
  2. sudo systemctl status circuitbreaker.service

새로운 Node 추가절차

  1. 새로운 Node 에 배포
  2. Master 에 ssh 로 접속하여 sudo systemctl restart circuitbreaker.service 실행
@4whomtbts
Copy link
Contributor Author

평소에 각 각의 노드와 마스터가 제대로 동작하는지 확인하는 메세지 추가

@jieun1128 jieun1128 self-assigned this Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants