본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Shard allocation filtering

원문 보기 위키 갱신

샤드 할당 필터링(Shard allocation filtering)은 노드 속성(node attributes)을 매칭해 인덱스의 샤드가 배치될 위치를 제한해 주는 기능이에요. 샤드를 특정 노드에 고정하거나 특정 노드를 피하도록 하거나, 특정 하드웨어나 존(zone)을 요구하도록 설정할 수 있어요. 샤드는 인덱스 레벨 샤드 할당 필터링과 클러스터 레벨 라우팅 인식(cluster-level routing awareness)을 포함해 모든 활성 필터를 만족하는 노드에만 할당돼요. 이 기능은 OpenSearch 1.0에서 처음 소개되었어요.

출처: OpenSearch 문서

본문

엔드포인트

PUT /{index}/_settings
GET /{index}/_settings

경로 매개변수

다음 표는 사용 가능한 경로 매개변수 목록이에요. 모든 경로 매개변수는 선택 사항이에요.

| Parameter | Data type | Description | | index | String | One or more comma-separated indexes from which to update or read settings. Use _all or * to target all indexes. |

내장 및 사용자 정의 속성

내장(built-in) 속성 또는 직접 정의한 커스텀 노드 속성으로 필터링할 수 있어요. 예를 들어 opensearch.yml에 node.attr.zone: zone-a를 추가하면 커스텀 속성을 정의할 수 있어요. 다음 내장 속성이 지원돼요.

| Attribute | Description | | _name | Match by node name. | | _host_ip | Match by host IP address. | | _publish_ip | Match by publish IP address. | | _ip | Match either _host_ip or _publish_ip. | | _host | Match by hostname. | | _id | Match by node ID. | | _tier | Match nodes by data tier role. |

필터 유형

다음 인덱스 설정을 사용해요.

| Setting | Effect | | index.routing.allocation.include. | Allocate shards to nodes that match any of the provided values. | | index.routing.allocation.exclude. | Do not allocate shards to nodes that match any of the provided values. | | index.routing.allocation.require. | Allocate shards only to nodes that match all of the provided values. |

예제 요청

다음 예제들은 샤드 할당 필터를 다양한 방식으로 사용하는 방법을 보여줘요.

인덱스를 특정 존에만 할당

다음 명령으로 인덱스를 zone-a의 노드에 할당해요:

PUT /test-index/_settings
{
"index.routing.allocation.require.zone": "zone-a"
}

IP로 노드 하위 집합에 할당

PUT /test-index/_settings
{
"index.routing.allocation.include._ip": "10.0.0.12,10.0.0.13"
}

인덱스를 노드에서 제외

다음 명령은 data-node-3 노드에서 인덱스를 제외해요:

PUT /test-index/_settings
{
"index.routing.allocation.exclude._name": "data-node-3"
}

필터 결합

다음 명령은 필요한 랙(rack)을 설정하되 data-node-7 노드는 제외해요:

PUT /test-index/_settings
{
"index": {
"routing.allocation.require.rack": "r1",
"routing.allocation.exclude._name": "data-node-7"
}
}

필터 지우기

필터를 지우려면 값을 null 또는 빈 문자열 ""로 설정하면 돼요:

PUT /test-index/settings
{
"persistent": {
"index.routing.allocation.exclude._host_ip": null
}
}

예제 응답

{
"acknowledged": true
}

더 알아보기 (Learn more)

클러스터 라우팅 인식과 샤드 배치를 더 깊이 이해하고 싶다면 원문 OpenSearch 문서를 확인해 주세요.