C.W.K.
Stream
Lesson 05 of 05 · published

Backup, Restore, 그리고 재해 drill

~18 min · chroma, operations

Level 0Scout
0 XP0/41 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Chroma on-disk 포맷은 SQLite + parquet 페어

chroma_store/ 디렉토리에 SQLite 메타데이터 DB + collection 별 parquet 파일. "backup" = "writer 멈췄을 때 이 디렉토리 복사". "restore" = "새 PersistentClient 를 복사한 디렉토리에 가리킴".

프로덕션에서 살아남는 backup 레시피

  1. write 일시 정지 (또는 backup 중 write 손실 감수).
  2. tar -cf chroma-$(date +%F).tar chroma_store/ 또는 sibling 디렉토리에 rsync.
  3. 새 client 로 copy 열어서 문서 count 검증.
  4. off-host storage (S3, NAS, 다른 Mac) 에 archive push.

recovery drill

분기당 한 번, 지난 주 backup 을 chroma_store_recovery/ 에 복원 + 스크립트 가리켜서 retrieval 여전히 작동하는지 확인. 한 번도 복원 안 한 backup 은 backup 이 아냐.

Code

write quiesce 상태에서 store snapshot·text
# 1. writer 프로세스 중지 (또는 API 를 read-only 로).
# 2. snapshot:
rsync -a --delete chroma_store/ chroma_store_$(date +%F)/
# 3. off-host 위해 tar + 압축:
tar -czf chroma_$(date +%F).tar.gz chroma_store_$(date +%F)/
# 4. write 재개.
backup 깨끗하게 로드되는지 verify·python
client_test = chromadb.PersistentClient(path='./chroma_store_2026-05-03')
for c in client_test.list_collections():
    coll = client_test.get_collection(c.name)
    print(f'{c.name}: {coll.count()} rows')
    sample = coll.peek(2)
    print(f'  sample id={sample["ids"][0] if sample["ids"] else None}')

External links

Exercise

cron, launchd, 또는 본인 선택 scheduler 로 chroma_store/ 의 daily backup 을 sibling 디렉토리에 스케줄. 그 다음 recovery drill 실행: 가장 최근 snapshot 을 새 client 로 열어서 query 3개 돌려, 결과가 live store 와 일치하는지 확인.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.