최후의 수단으로 잃어버린 primary 샤드 할당 (allocate_stale_primary)
Elasticsearch클러스터/노드명령어
# Which nodes hold copies of the primary (allocation id, store errors):
GET _shard_stores/musteri?status=red
# Last resort: promote a stale copy to primary; data loss is accepted:
POST _cluster/reroute
{
"commands": [
{
"allocate_stale_primary": {
"index": "musteri",
"shard": 0,
"node": "node-2",
"accept_data_loss": true
}
}
]
}하는 일
최신 primary 사본을 가진 노드를 영구히 잃었을 때 다른 노드의 오래된(in-sync가 아닌) 사본을 primary로 지정하여 인덱스를 red에서 벗어나게 한다.
사용 시점
primary를 호스팅하던 노드를 복구할 수 없고 스냅샷 복원이 불가능하거나 더 오래 걸릴 때만.
주의
오래된 사본에는 최신 쓰기가 없으므로 그 사본 이후의 모든 쓰기가 영구 손실된다. 잃었던 노드가 나중에 돌아오면 그 노드의 더 최신 사본은 삭제된다. 먼저 노드 복구와 스냅샷 복원을 고려한다. allocate_empty_primary는 샤드를 완전히 빈 상태로 만들어 해당 샤드의 모든 데이터를 삭제하므로 사본이 하나도 남지 않았을 때만 사용한다.