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

Cluster Settings API

원문 보기 위키 갱신

버전 1.0 도입

Cluster Settings API는 OpenSearch 클러스터의 모든 노드에 적용되는 클러스터 전체 설정을 조회하거나 수정해요. 이 API로 변경한 설정은 opensearch.yml 구성 파일에 정의된 설정보다 우선해요.

Cluster Settings API는 다음과 같은 목적으로 사용해요:

  • 각 노드의 설정 파일에 접근하지 않고도 현재 클러스터 구성 정보를 조회해 클러스터가 어떻게 구성되어 있는지 파악할 때.
  • 샤드 할당 설정이나 복구 속도 같은 클러스터 동작을 클러스터 재시작 없이 동적으로 조정할 때.
  • 클러스터의 모든 노드에서 일관되게 유지되어야 하는 설정을 관리해 균일한 동작을 보장할 때.
  • 클러스터를 재시작해도 유지되지 않는 transient 설정을 이용해 테스트나 문제 해결을 목적으로 설정을 임시로 변경할 때.

이 API로 클러스터 전체 설정을 관리하는 것이 설정 파일을 직접 편집하는 것보다 권장돼요. 모든 노드에 걸쳐 일관성을 보장하고, 재시작 없이 동적으로 갱신할 수 있기 때문이에요.

클러스터 설정을 갱신할 때 변경 사항이 persistent(클러스터 재시작 후에도 유지)인지 transient(재시작 후 사라짐)인지 지정할 수 있어요. persistent/transient 설정, 설정 우선순위, 설정 초기화에 대한 자세한 내용은 Configuring OpenSearch 문서를 참고하세요.

출처: OpenSearch 문서

본문

Endpoints

GET /_cluster/settings
PUT /_cluster/settings

Query parameters

아래 표는 사용할 수 있는 query parameter를 정리한 거예요. 모든 query parameter는 선택 사항이에요.

| Parameter | Data type | 설명 | | cluster_manager_timeout | String | 클러스터 매니저 노드의 응답을 기다리는 시간이에요. 지원되는 시간 단위에 대한 자세한 내용은 Common parameters 문서를 참고하세요. (기본값: 30s) | | flat_settings | Boolean | 설정을 평면(flat) 형태로 반환할지 여부예요. 특히 깊게 중첩된 설정에서 가독성을 높일 수 있어요. 예를 들어 "cluster": { "max_shards_per_node": 500 }의 평면 형태는 "cluster.max_shards_per_node": "500"이에요. (기본값: false) | | include_defaults | Boolean | GET 전용이에요. true이면 로컬 노드의 기본 클러스터 설정을 반환해요. (기본값: false) | | timeout | String | PUT 전용이에요. 기간(duration) 값이에요. 단위는 nanos, micros, ms(밀리초), s(초), m(분), h(시간), d(일)이에요. 단위 없는 0과 지정되지 않은 값을 뜻하는 -1도 받아들여요. (기본값: 30s) | | master_timeout DEPRECATED | String | (2.0부터 사용 중단: 포용적인 언어를 위해 cluster_manager_timeout을 사용하세요.) 기간(duration) 값이에요. 단위는 nanos, micros, ms(밀리초), s(초), m(분), h(시간), d(일)이에요. 단위 없는 0과 지정되지 않은 값을 뜻하는 -1도 받아들여요. |

Request body fields

GET 연산에는 요청 본문이 없어요. 아래 표는 PUT 연산의 요청 본문 필드를 정리한 거예요.

| Field | Data type | 설명 | | persistent | Object | 전체 클러스터 재시작 후에도 유지되는 설정이에요. 이 설정들은 클러스터 상태에 기록되며, 명시적으로 변경하기 전까지 유지돼요. | | transient | Object | 다음 전체 클러스터 재시작까지만 적용되는 설정이에요. 테스트나 문제 해결 중 임시 구성 변경에 유용해요. |

persistent 또는 transient 객체 안에는 갱신하려는 설정을 키-값(key-value) 쌍으로 지정해요. 예를 들어:

{
"persistent": {
"cluster.max_shards_per_node": 500
}
}

모든 클러스터 설정이 Cluster Settings API로 동적으로 갱신될 수 있는 건 아니에요. 이 API로 static 설정을 구성하려 하면 "setting [cluster.some.setting], not dynamically updateable"이라는 오류 메시지를 받게 돼요. static 설정은 opensearch.yml 파일에 구성해야 하며 노드 재시작이 필요해요.

사용 가능한 모든 클러스터 설정의 전체 목록은 Configuring OpenSearch 문서를 참고하세요.

Example: Retrieving current cluster settings

기본값 없이 현재 클러스터 설정을 보려면 GET 요청을 보내요:

REST Python

GET /_cluster/settings

Copy Copy as cURL

response = client.cluster.get_settings()

Copy

Example response

응답에는 명시적으로 구성된 persistent/transient 설정이 표시돼요. 빈 객체는 해당 유형의 설정이 없다는 뜻이에요:

{
"persistent": {
"cluster": {
"routing": {
"allocation": {
"load_awareness": {
"flat_skew": "2"
}
}
},
"max_voting_config_exclusions": "10",
"metadata": {
"key": "10s"
},
"auto_shrink_voting_configuration": "true",
"blocks": {
"create_index": "false",
"create_index.auto_release": "true"
},
"thread_pool": {
"generic": {
"max": "5"
}
},
"max_shards_per_node": "500",
"remote": {
"my_remote_cluster": {
"seeds": [
"127.0.0.1:9300"
]
},
"opensearch-cluster": {
"mode": "proxy"
}
},
"no_cluster_manager_block": "write"
},
"indices": {
"mapping": {
"max_in_flight_updates": "10"
}
},
"plugins": {
"ml_commons": {
"only_run_on_ml_node": "false",
"mcp_server_enabled": "true",
"native_memory_threshold": "99"
}
},
"search_backpressure": {
"mode": "monitor_only"
},
"action": {
"auto_create_index": "true"
},
"wlm": {
"workload_group": {
"mode": "disabled",
"duress_streak": "10"
}
},
"admission_control": {
"cluster": {
"admin": {
"cpu_usage": {
"limit": "4"
}
}
}
},
"script": {
"context": {
"field": {
"max_compilations_rate": "75/5m",
"cache_expire": "0ms",
"cache_max_size": "100"
},
"search": {
"max_compilations_rate": "75/5m",
"cache_expire": "0ms",
"cache_max_size": "100"
},
"ingest": {
"max_compilations_rate": "75/5m",
"cache_expire": "0ms",
"cache_max_size": "100"
}
}
}
},
"transient": {
"cluster": {
"max_shards_per_node": "1000"
}
}
}

Example: Including default settings

기본값을 포함한 모든 클러스터 설정을 가져오려면 include_defaults 파라미터를 사용해요:

REST Python

GET /_cluster/settings?include_defaults=true

Copy Copy as cURL

response = client.cluster.get_settings(
params = { "include_defaults": "true" }
)

Copy

Example response

응답에는 모든 기본 클러스터 설정을 담은 defaults 객체가 포함돼요(간결함을 위해 줄여서 표시). 설정을 바꾸기 전에 설정 이름과 기본값을 파악하는 데 유용해요:

{
"persistent" : { },
"transient" : { },
"defaults" : {
"task_resource_tracking" : {
"enabled" : "true"
},
"cluster" : {
"metadata" : {
"perf_analyzer" : {
"collectors" : {
"mode" : "0"
},
"state" : "0",
"config" : {
"overrides" : ""
},
"pa_node_stats_setting" : "1"
}
},
"no_master_block" : "metadata_write",
"persistent_tasks" : {
"allocation" : {
"enable" : "all",
"recheck_interval" : "30s"
}
},
"initial_cluster_manager_nodes" : [
"opensearch-node1"
]
}
}
}

Example: Using flat settings format

중첩된 설정의 가독성을 높이는 평면 형식으로 설정을 반환하려면 flat_settings 파라미터를 사용해요:

REST Python

GET /_cluster/settings?flat_settings=true

Copy Copy as cURL

response = client.cluster.get_settings(
params = { "flat_settings": "true" }
)

Copy

Example response

{
"persistent": {
"action.auto_create_index": "true",
"admission_control.cluster.admin.cpu_usage.limit": "4",
"cluster.auto_shrink_voting_configuration": "true",
"cluster.blocks.create_index": "false",
"cluster.blocks.create_index.auto_release": "true",
"cluster.max_shards_per_node": "500",
"cluster.max_voting_config_exclusions": "10",
"cluster.metadata.key": "10s",
"cluster.no_cluster_manager_block": "write",
"cluster.remote.my_remote_cluster.seeds": [
"127.0.0.1:9300"
],
"cluster.remote.opensearch-cluster.mode": "proxy",
"cluster.routing.allocation.load_awareness.flat_skew": "2",
"cluster.thread_pool.generic.max": "5",
"indices.mapping.max_in_flight_updates": "10",
"plugins.ml_commons.mcp_server_enabled": "true",
"plugins.ml_commons.native_memory_threshold": "99",
"plugins.ml_commons.only_run_on_ml_node": "false",
"script.context.field.cache_expire": "0ms",
"script.context.field.cache_max_size": "100",
"script.context.field.max_compilations_rate": "75/5m",
"script.context.ingest.cache_expire": "0ms",
"script.context.ingest.cache_max_size": "100",
"script.context.ingest.max_compilations_rate": "75/5m",
"script.context.search.cache_expire": "0ms",
"script.context.search.cache_max_size": "100",
"script.context.search.max_compilations_rate": "75/5m",
"search_backpressure.mode": "monitor_only",
"wlm.workload_group.duress_streak": "10",
"wlm.workload_group.mode": "disabled"
},
"transient": {
"cluster.max_shards_per_node": "1000"
}
}

Example: Updating persistent settings

클러스터 재시작 후에도 유지되는 설정을 갱신하려면 persistent 객체에 넣어요:

REST Python

PUT /_cluster/settings
{
"persistent": {
"cluster.max_shards_per_node": 500
}
}

Copy Copy as cURL

response = client.cluster.put_settings(
body =   {
"persistent": {
"cluster.max_shards_per_node": 500
}
}
)

Copy

Example response

acknowledged 필드는 설정이 성공적으로 갱신되었음을 나타내요. 응답에는 갱신된 설정이 포함돼요:

{
"acknowledged" : true,
"persistent" : {
"cluster" : {
"max_shards_per_node" : "500"
}
},
"transient" : { }
}

Example: Updating transient settings

설정을 임시로(다음 전체 클러스터 재시작까지) 갱신하려면 transient 객체에 넣어요:

REST Python

PUT /_cluster/settings
{
"transient": {
"indices.recovery.max_bytes_per_sec": "20mb"
}
}

Copy Copy as cURL

response = client.cluster.put_settings(
body =   {
"transient": {
"indices.recovery.max_bytes_per_sec": "20mb"
}
}
)

Copy

Example response

acknowledged 필드는 설정이 성공적으로 갱신되었음을 나타내요. 응답에는 갱신된 설정이 포함돼요:

{
"acknowledged" : true,
"persistent" : { },
"transient" : {
"indices" : {
"recovery" : {
"max_bytes_per_sec" : "20mb"
}
}
}
}

Example: Resetting a setting

설정을 기본값으로 초기화하려면 null을 지정해요:

REST Python

PUT /_cluster/settings
{
"transient": {
"indices.recovery.max_bytes_per_sec": null
}
}

Copy Copy as cURL

response = client.cluster.put_settings(
body =   {
"transient": {
"indices.recovery.max_bytes_per_sec": null
}
}
)

Copy

Example: Resetting multiple settings with wildcards

여러 관련 설정을 한 번에 초기화하려면 와일드카드 패턴을 사용해요:

REST Python

PUT /_cluster/settings
{
"persistent": {
"indices.recovery.*": null
}
}

Copy Copy as cURL

response = client.cluster.put_settings(
body =   {
"persistent": {
"indices.recovery.*": null
}
}
)

Copy

Example response

설정을 초기화하면 그 설정은 응답에 더 이상 나타나지 않아요. 해당 설정은 이제 우선순위 순서상 다음 값을 사용해요:

{
"acknowledged" : true,
"persistent" : { },
"transient" : { }
}

Response fields

아래 표는 응답 필드를 정리한 거예요.

| Field | Data type | 설명 | | acknowledged | Boolean | 설정 갱신이 클러스터에 성공적으로 적용되었는지 나타내요. PUT 응답에만 존재해요. | | persistent | Object | 명시적으로 구성된 모든 persistent 클러스터 설정을 담아요. 이 객체의 설정은 전체 클러스터 재시작 후에도 유지돼요. | | transient | Object | 명시적으로 구성된 모든 transient 클러스터 설정을 담아요. 이 객체의 설정은 전체 클러스터 재시작 후 사라져요. | | defaults | Object | 기본값과 함께 모든 기본 클러스터 설정을 담아요. GET 요청에서 include_defaults 파라미터가 true일 때만 존재해요. |

Required permissions

Security 플러그인을 사용한다면 cluster:admin/settings/update 권한이 필요해요.

  • transient 설정, persistent 설정, 설정 우선순위에 대한 자세한 내용은 Configuring OpenSearch 문서를 참고하세요.

더 알아보기 (Learn more)

클러스터 설정을 다룰 때는 persistent와 transient의 차이, 그리고 어느 설정이 동적으로 갱신 가능한지 미리 파악해야 해요. static 설정은 API로 바꿀 수 없으니 opensearch.yml에서 구성해 주세요.