Obsidian/Recognition/Programing/ELK/ELK 백업 및 복구.md

1.1 KiB

https://ryeon9445.com/develop/1-elasitcsearch-snapshot/



# elasticsearch.yml 편집
path.repo: ["/usr/share/elasticsearch/backup"]

# docker-compose 볼륨 추가
volumes:
  - /data/elk_data/backup:/usr/share/elasticsearch/backup

# Kibana에서 스냅샷 레파지토리 생성
PUT /_snapshot/backup
{
  "type": "fs",
  "settings": {
    "compress": true,
    "location": "/usr/share/elasticsearch/backup"
  }
}

# 레파지토리 생성 확인
GET _snapshot

# 레파지토리 소유 권한 변경
docker exec -it es01 bash
cd /usr/share/elasticsearch
chown -R elasticsearch:elasticsearch ./backup

# 스냅샷 생성
PUT /_snapshot/backup/backup_20240625?wait_for_completion=true
{
  "ignore_unavailable": true,
  "include_global_state": true
}

## 특정인덱스 지정 하련는 경우 : "indices": ${인덱스명} 추가

-------------------------------------
kibana Snapshot and Restore -> policy 생성
Name : log_backup
Snapshot name : <log_backup-{now/d}>


-------------------------------------

# 스냅샷 삭제
DELETE /_snapshot/backup/test-2018.12.06


# 레파지토리 삭제
DELETE /_snapshot/backup