-
Curator를 활용한 Snapshot 테스트Elasticsearch 2025. 1. 8. 21:01
데이터 생애주기를 관리하기 위하여 Curator을 활용한 Bash Script를 구성해보았습니다..!
현재 Crontab으로 하루에 한번 운용되고 있으며 아래와 같은 순서로 동작이 구성되었습니다.
동작 순서
1. allocation : hot → warm
2. snapshot : 사용자 인덱스만 snapshot 생성
3. delete_indices : snapshot이 완료된 인덱스 삭제#!/bin/bash snapshot_date=$(date -d '7 days ago' +%Y%m%d) snapshot_name="lucy_main_bac1_${snapshot_date}_snapshot" cat << EOF > action_file.yml actions: 1: action: allocation description: "apply shard allocation" options: key: tier value: warm wait_for_completion: True allocation_type: require filters: - filtertype: pattern kind: prefix value: 'lucy_main_bac1_' - filtertype: age source: name timestring: '%Y%m%d' unit: days unit_count: 3 direction: older 2: action: snapshot description: "Snapshot" options: repository: backup name: ${snapshot_name} wait_for_completion: True max_wait: 3000 include_global_state: False ignore_unavailable: False wait_interval: 5 filters: - filtertype: pattern kind: prefix value: 'main_target_' - filtertype: age source: name timestring: '%Y%m%d' unit: days unit_count: 7 direction: older 3: action: delete_indices description: "Delete Selected indices" options: continue_if_exception: False filters: - filtertype: pattern kind: prefix value: 'main_target_' - filtertype: age source: name timestring: '%Y%m%d' unit: days unit_count: 7 direction: older EOF /usr/local/bin/curator --config /app/curator.yml /app/action_file.yml매일 갱신해야 하기 때문에 동적인 변수 할당을 위해 Script로 작성하여 실행
Curator을 통한 Snapshot 결과
2025년 1월 1일
목표 인덱스 : main_target_20250101
데이터량 : 약 400만건
걸린 시간 : 8 min
2025년 1월 2일
목표 인덱스 : main_target_20250102
데이터량 : 약 400만건 (4,002,556)
걸린 시간 : 8 min'Elasticsearch' 카테고리의 다른 글
profile을 통해 실제 쿼리가 어떻게 구성되는지 확인해보기 (0) 2025.03.27 인덱스 샤드 설정에 대해 (0) 2025.03.22 docker-compose.yml 활용하여 Elasticsearch Cluster 만들기 (4) 2024.10.25 Curator에 대해 (5) 2024.10.09 Elasticsearch ILM 탐색기 (2) 2024.06.29