본문 바로가기
PROMETHEUS

prometheus 에서 no space left on device 에러 발생시

by 정윤재 2023. 5. 29.

prometheus 에서 

 

err="write to WAL: log samples: write /prometheus/wal/123456: no space left on device"

 

와 같은 오류가 발생 할 수 있다.  해당 에러 메시지는 말 그대로 데이터 저장 공간이 

부족하다는 메시지 이다.

 

해당 오류가 발생 했을 때의 전략을 아래와 같이 살펴 본다.

 

1. 기존 prometheus 데이터를 backup 할 NAS 를 mount 한다. (control plain 에)

 

2. prometheus sts 의 replica 를 0으로 만든다.

 

3. prometheus db 데이터 snapshot 을 뜬다.

 

4. pod 의 container 내부의 데이터를 backup NAS 로 복사 한다.

 

5. prometheus 를 재설치 (변경 된 용량의 pv,pvc)

 

6. 백업 NAS 의 데이터를 가지고와서 신규 컨테이너로 복사 해 줌

 

 

 

* master (control plain) 에서 

- backup nas 를 mount 해 줌

 

* sts 의 replicas 를 0 으로 바꿔 주는 방법

 

kubectl scale sts -n [namespace명] [sts 명] --replicas=0

 

예) kubectl scale sts -n monitor prometheus-prometheus-kube-prometheus-prometheus --replicas=0

 

 

* prometheus db 데이터 backup, restore

[작성중]

 

 

 

* POD에서 로컬로 file 복사를 하기 위해선 아래와 같이 해줘야 함
kubectl cp namespace명/pod이름:디렉토리/파일이름 /옮길 디렉토리/파일이름

예) kubectl cp monitor/prometheus-prometheus-kube-prometheus-prometheus-0:/prometheus/. -c prometheus /backup/prometheus

 

* pvc 삭제, sts 삭제

kubectl delete pvc/pvc명 -n namespace명 

kubectl delete sts/sts명 -n namespace명

 

* backup 한 prometheus db 파일 중 불필요한 lock 관련 된 파일들 삭제

rm -rf lock chunk_head queries.active 

 

* pod 내부로 복사

 

for file in $(ls /backup/prometheus)

do

kubectl cp $file monitor/prometheus-prometheus-kube-prometheus-prometheus-0:/prometheus/. -c prometheus

done

 

와 같이 데이터를 내부로 복사해 준다.

'PROMETHEUS' 카테고리의 다른 글

메트릭 (metric) 이란  (0) 2023.06.19
prometheus operator 간단 설치 (NodePort 사용)  (1) 2023.06.02

댓글