DBAtlas · 데이터베이스 운영 아틀라스

SLM으로 스냅샷과 보존 자동화, 스냅샷 진행 모니터링

Elasticsearch스냅샷

명령어

# Take a snapshot every night at 01:30, keep for 30 days (at least 7, at most 60 snapshots):
PUT _slm/policy/gece-yedek
{
  "schedule": "0 30 1 * * ?",
  "name": "<gece-{now/d}>",
  "repository": "yedek_repo",
  "config": { "indices": ["*"], "include_global_state": true },
  "retention": { "expire_after": "30d", "min_count": 7, "max_count": 60 }
}
# Run the policy now and see success/failure statistics:
POST _slm/policy/gece-yedek/_execute
GET _slm/stats
# Snapshot in progress and per-shard progress:
GET _snapshot/yedek_repo/_current
GET _snapshot/yedek_repo/_status
GET _cat/snapshots/yedek_repo?v&s=end_epoch:desc
# Verify that the repository is writable from all nodes:
POST _snapshot/yedek_repo/_verify

하는 일

cron 일정으로 스냅샷을 만들고 보존 규칙에 따라 오래된 스냅샷을 삭제하는 SLM 정책을 정의한다. 실행 중인 스냅샷의 샤드별 진행 상황, 과거 스냅샷, repository 접근성을 보여 준다.

사용 시점

정기 백업을 설정할 때, 야간 스냅샷 실패 알림 시, 또는 오래 걸리는 스냅샷이 언제 끝날지 추정할 때.

주의

일정은 UTC로 평가된다. 둘 이상의 클러스터가 같은 repository에 쓰거나 다른 클러스터에 repository가 쓰기 가능으로 등록되어 있으면 손상될 수 있으므로 다른 클러스터에서는 readonly: true를 사용한다. 보존 규칙은 SLM이 만든 스냅샷만 삭제한다. include_global_state true는 복원 시 템플릿과 persistent 클러스터 설정도 복원할 수 있다.

DBAtlas에서 열기 →

관련 항목