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

Cluster Stats API

원문 보기 위키 갱신

Cluster Stats API는 클러스터 전체의 상위 레벨(High-level) 통계를 반환하는 API예요. 샤드 개수, 스토리지 크기, 메모리 사용량 같은 핵심 인덱스 지표와 함께, 노드 개수·노드 역할·운영체제·JVM 버전·리소스 사용량(메모리와 CPU)·설치된 플러그인 등 클러스터 노드에 대한 상세 정보도 제공해요. 클러스터가 전반적으로 어떻게 돌아가고 있는지 점검할 때 유용해요. 이 기능은 OpenSearch 1.0에서 처음 소개되었어요.

출처: OpenSearch 문서

본문

엔드포인트

GET /_cluster/stats
GET /_cluster/stats/nodes/{node_id}
GET /_cluster/stats/{metric}/nodes/{node_id}
GET /_cluster/stats/{metric}/{index_metric}/nodes/{node_id}

경로 매개변수

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

| Parameter | Data type | Description | | index_metric | List | A comma-separated list of index metric groups, for example, docs,store. | | metric | List | Limit the information returned to the specified metrics. | | node_id | List or String | A comma-separated list of node IDs used to filter results. Supports node filters. |

master라는 용어는 OpenSearch 2.0 이후 cluster_manager로 대체되었지만, 하위 호환성을 위해 master 필드는 계속 유지되었어요. master 역할이나 cluster_manager 역할을 가진 노드가 있으면 두 필드 모두 개수가 1씩 증가해요. 노드 개수 증가 예시는 예제 응답을 참고해 주세요.

쿼리 매개변수

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

| Parameter | Data type | Description | | flat_settings | Boolean | Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of "cluster": { "max_shards_per_node": 500 } is "cluster.max_shards_per_node": "500". (Default: false) | | timeout | String | The amount of time to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, timed out nodes are included in the response’s _nodes.failed property. Defaults to no timeout. |

메트릭 그룹(Metric groups)

다음 표는 사용 가능한 모든 메트릭 그룹을 보여줘요.

| Metric | Description | | indices | Statistics about indexes in the cluster. | | os | Statistics about the operating system, including load and memory. | | process | Statistics about processes, including open file descriptors and CPU usage. | | jvm | Statistics about the JVM, including heap usage and threads. | | fs | Statistics about file system usage. | | plugins | Statistics about OpenSearch plugins integrated with the nodes. | | network_types | Statistics about the transport and HTTP networks connected to the nodes. | | discovery_type | Statistics about the discovery methods used by the nodes to find other nodes in the cluster. | | packaging_types | Statistics about each node’s OpenSearch distribution. | | ingest | Statistics about ingest pipelines. |

인덱스 메트릭 그룹(Index metric groups)

indices 메트릭에서 반환되는 정보를 좁히려면 특정 index_metric 값을 사용할 수 있어요. 이 값들은 다음 쿼리 유형을 사용할 때만 지원돼요:

GET _cluster/stats/_all/{index_metric}/nodes/{node_id}
GET _cluster/stats/indices/{index_metric}/nodes/{node_id}

다음 인덱스 메트릭이 지원돼요:

  • shards
  • docs
  • store
  • fielddata
  • query_cache
  • completion
  • segments
  • mappings
  • analysis

예제 요청: 특정 인덱스 메트릭 조회

다음 예제 요청은 모든 노드에 대해 docs와 segments 인덱스 메트릭의 통계를 조회해요:

GET /_cluster/stats/indices/docs,segments/nodes/_all
response = client.cluster.stats(
index_metric = "docs,segments",
metric = "indices",
node_id = "_all"
)

예제 요청: 특정 노드의 통계 조회

다음 예제 요청은 클러스터 매니저 노드에 대한 정보를 반환해요:

GET /_cluster/stats/nodes/_cluster_manager
response = client.cluster.stats(
node_id = "_cluster_manager"
)

예제 요청: 사람이 읽기 쉬운 출력 사용

다음 예제 요청은 human 쿼리 매개변수를 포함해 바이트와 크기 값을 사람이 읽기 쉬운 형식으로 반환해요:

GET /_cluster/stats?human&pretty
response = client.cluster.stats(
params = { "human": "true", "pretty": "true" }
)

human 매개변수는 원래의 숫자 값을 보존하면서 응답에 사람이 읽기 쉬운 필드를 추가해요. 예를 들어 jvm.max_uptime_in_millis 필드는 기본 응답에서 숫자 값만 보여줘요:

"jvm": {
"max_uptime_in_millis": 21476787
}

human 매개변수를 포함하면 응답에 사람이 읽기 쉬운 max_uptime 필드와 원래 숫자 필드가 모두 포함돼요:

"jvm": {
"max_uptime": "5.9h",
"max_uptime_in_millis": 21480995
}

예제 응답

{
"_nodes": {
"total": 1,
"successful": 1,
"failed": 0
},
"cluster_name": "opensearch-cluster",
"cluster_uuid": "QravFieJS_SlZJyBMcDMqQ",
"timestamp": 1644607845054,
"status": "yellow",
"indices": {
"count": 114,
"shards": {
"total": 121,
"primaries": 60,
"replication": 1.0166666666666666,
"index": {
"shards": {
"min": 1,
"max": 2,
"avg": 1.0614035087719298
},
"primaries": {
"min": 0,
"max": 2,
"avg": 0.5263157894736842
},
"replication": {
"min": 0.0,
"max": 1.0,
"avg": 0.008771929824561403
}
}
},
"docs": {
"count": 134263,
"deleted": 115
},
"store": {
"size_in_bytes": 70466547,
"reserved_in_bytes": 0
},
"fielddata": {
"memory_size_in_bytes": 664,
"evictions": 0,
"item_count": 1
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 1,
"hit_count": 0,
"miss_count": 1,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 341,
"memory_in_bytes": 3137244,
"terms_memory_in_bytes": 2488992,
"stored_fields_memory_in_bytes": 167672,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 346816,
"points_memory_in_bytes": 0,
"doc_values_memory_in_bytes": 133764,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 1112,
"max_unsafe_auto_id_timestamp": 1644269449096,
"remote_store" : {
"upload" : {
"total_upload_size" : {
"started_bytes" : 152419,
"succeeded_bytes" : 152419,
"failed_bytes" : 0
},
"refresh_size_lag" : {
"total_bytes" : 0,
"max_bytes" : 0
},
"max_refresh_time_lag_in_millis" : 0,
"total_time_spent_in_millis" : 516,
"pressure" : {
"total_rejections" : 0
}
},
"download" : {
"total_download_size" : {
"started_bytes" : 0,
"succeeded_bytes" : 0,
"failed_bytes" : 0
},
"total_time_spent_in_millis" : 0
}
},
"file_sizes": {}
},
"mappings": {
"field_types": [
{
"name": "alias",
"count": 1,
"index_count": 1
},
{
"name": "binary",
"count": 1,
"index_count": 1
},
{
"name": "boolean",
"count": 87,
"index_count": 22
},
{
"name": "date",
"count": 185,
"index_count": 91
},
{
"name": "double",
"count": 5,
"index_count": 2
},
{
"name": "float",
"count": 4,
"index_count": 1
},
{
"name": "geo_point",
"count": 4,
"index_count": 3
},
{
"name": "half_float",
"count": 12,
"index_count": 1
},
{
"name": "integer",
"count": 144,
"index_count": 29
},
{
"name": "ip",
"count": 2,
"index_count": 1
},
{
"name": "keyword",
"count": 1939,
"index_count": 109
},
{
"name": "knn_vector",
"count": 1,
"index_count": 1
},
{
"name": "long",
"count": 158,
"index_count": 92
},
{
"name": "nested",
"count": 25,
"index_count": 10
},
{
"name": "object",
"count": 420,
"index_count": 91
},
{
"name": "text",
"count": 1768,
"index_count": 102
}
]
},
"analysis": {
"char_filter_types": [],
"tokenizer_types": [],
"filter_types": [],
"analyzer_types": [],
"built_in_char_filters": [],
"built_in_tokenizers": [],
"built_in_filters": [],
"built_in_analyzers": [
{
"name": "english",
"count": 1,
"index_count": 1
}
]
}
},
"nodes": {
"count": {
"total": 1,
"coordinating_only": 0,
"data": 1,
"ingest": 1,
"master": 1,
"cluster_manager": 1,
"remote_cluster_client": 1
},
"versions": [
"1.2.4"
],
"os": {
"available_processors": 6,
"allocated_processors": 6,
"names": [
{
"name": "Linux",
"count": 1
}
],
"pretty_names": [
{
"pretty_name": "Amazon Linux 2",
"count": 1
}
],
"mem": {
"total_in_bytes": 6232674304,
"free_in_bytes": 1452658688,
"used_in_bytes": 4780015616,
"free_percent": 23,
"used_percent": 77
}
},
"process": {
"cpu": {
"percent": 0
},
"open_file_descriptors": {
"min": 970,
"max": 970,
"avg": 970
}
},
"jvm": {
"max_uptime_in_millis": 108800629,
"versions": [
{
"version": "15.0.1",
"vm_name": "OpenJDK 64-Bit Server VM",
"vm_version": "15.0.1+9",
"vm_vendor": "AdoptOpenJDK",
"bundled_jdk": true,
"using_bundled_jdk": true,
"count": 1
}
],
"mem": {
"heap_used_in_bytes": 178956256,
"heap_max_in_bytes": 536870912
},
"threads": 112
},
"fs": {
"total_in_bytes": 62725623808,
"free_in_bytes": 28442726400,
"available_in_bytes": 25226010624
},
"plugins": [
{
"name": "opensearch-index-management",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "OpenSearch Index Management Plugin",
"classname": "org.opensearch.indexmanagement.IndexManagementPlugin",
"custom_foldername": "",
"extended_plugins": [
"opensearch-job-scheduler"
],
"has_native_controller": false
},
{
"name": "opensearch-security",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "Provide access control related features for OpenSearch 1.0.0",
"classname": "org.opensearch.security.OpenSearchSecurityPlugin",
"custom_foldername": "opensearch-security",
"extended_plugins": [],
"has_native_controller": false
},
{
"name": "opensearch-cross-cluster-replication",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "OpenSearch Cross Cluster Replication Plugin",
"classname": "org.opensearch.replication.ReplicationPlugin",
"custom_foldername": "",
"extended_plugins": [],
"has_native_controller": false
},
{
"name": "opensearch-job-scheduler",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "OpenSearch Job Scheduler plugin",
"classname": "org.opensearch.jobscheduler.JobSchedulerPlugin",
"custom_foldername": "",
"extended_plugins": [],
"has_native_controller": false
},
{
"name": "opensearch-anomaly-detection",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "OpenSearch anomaly detector plugin",
"classname": "org.opensearch.ad.AnomalyDetectorPlugin",
"custom_foldername": "",
"extended_plugins": [
"lang-painless",
"opensearch-job-scheduler"
],
"has_native_controller": false
},
{
"name": "opensearch-performance-analyzer",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "OpenSearch Performance Analyzer Plugin",
"classname": "org.opensearch.performanceanalyzer.PerformanceAnalyzerPlugin",
"custom_foldername": "",
"extended_plugins": [],
"has_native_controller": false
},
{
"name": "opensearch-reports-scheduler",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "Scheduler for Dashboards Reports Plugin",
"classname": "org.opensearch.reportsscheduler.ReportsSchedulerPlugin",
"custom_foldername": "",
"extended_plugins": [
"opensearch-job-scheduler"
],
"has_native_controller": false
},
{
"name": "opensearch-asynchronous-search",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "Provides support for asynchronous search",
"classname": "org.opensearch.search.asynchronous.plugin.AsynchronousSearchPlugin",
"custom_foldername": "",
"extended_plugins": [],
"has_native_controller": false
},
{
"name": "opensearch-knn",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "OpenSearch k-NN plugin",
"classname": "org.opensearch.knn.plugin.KNNPlugin",
"custom_foldername": "",
"extended_plugins": [
"lang-painless"
],
"has_native_controller": false
},
{
"name": "opensearch-alerting",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "Amazon OpenSearch alerting plugin",
"classname": "org.opensearch.alerting.AlertingPlugin",
"custom_foldername": "",
"extended_plugins": [
"lang-painless"
],
"has_native_controller": false
},
{
"name": "opensearch-observability",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "OpenSearch Plugin for OpenSearch Dashboards Observability",
"classname": "org.opensearch.observability.ObservabilityPlugin",
"custom_foldername": "",
"extended_plugins": [],
"has_native_controller": false
},
{
"name": "opensearch-sql",
"version": "1.2.4.0",
"opensearch_version": "1.2.4",
"java_version": "1.8",
"description": "OpenSearch SQL",
"classname": "org.opensearch.sql.plugin.SQLPlugin",
"custom_foldername": "",
"extended_plugins": [],
"has_native_controller": false
}
],
"network_types": {
"transport_types": {
"org.opensearch.security.ssl.http.netty.SecuritySSLNettyTransport": 1
},
"http_types": {
"org.opensearch.security.http.SecurityHttpServerTransport": 1
}
},
"discovery_types": {
"zen": 1
},
"packaging_types": [
{
"type": "tar",
"count": 1
}
],
"ingest": {
"number_of_pipelines": 0,
"processor_stats": {}
}
}
}

응답 본문 필드

다음 표는 응답 필드를 보여줘요.

| Field | Data type | Description | | _nodes | Object | Provides a summary of node-level request results. | | _nodes.total | Integer | The total number of nodes included in the request. | | _nodes.successful | Integer | The number of nodes that successfully processed the request. | | _nodes.failed | Integer | The number of nodes that failed to respond or rejected the request. If nonzero, failure details are included in the response. | | cluster_name | String | The name of the cluster. | | cluster_uuid | String | The unique identifier of the cluster. | | timestamp | Long | The time when the cluster statistics were last updated, in milliseconds since epoch. | | status | String | The cluster health status: green, yellow, or red. | | indices | Object | Aggregated statistics for indexes with shards on the specified nodes. | | indices.count | Integer | The total number of indexes with shards on the specified nodes. | | indices.shards | Object | Aggregated shard statistics for the specified nodes. | | indices.shards.total | Integer | The total number of shards on the specified nodes. | | indices.shards.primaries | Integer | The number of primary shards on the specified nodes. | | indices.shards.replication | Float | The ratio of replica shards to primary shards across the specified nodes. | | indices.shards.index.shards.min | Integer | The minimum number of shards per index (considering only shards on the specified nodes). | | indices.shards.index.shards.max | Integer | The maximum number of shards per index (considering only shards on the specified nodes). | | indices.shards.index.shards.avg | Float | The average number of shards per index (considering only shards on the specified nodes). | | indices.shards.index.primaries.min | Integer | The minimum number of primary shards per index (considering only shards on the specified nodes). | | indices.shards.index.primaries.max | Integer | The maximum number of primary shards per index (considering only shards on the specified nodes). | | indices.shards.index.primaries.avg | Float | The average number of primary shards per index (considering only shards on the specified nodes). | | indices.shards.index.replication.min | Float | The minimum replication factor per index (considering only shards on the specified nodes). | | indices.shards.index.replication.max | Float | The maximum replication factor per index (considering only shards on the specified nodes). | | indices.shards.index.replication.avg | Float | The average replication factor per index (considering only shards on the specified nodes). | | indices.docs | Object | Document statistics for the specified nodes. | | indices.docs.count | Integer | The total number of non-deleted documents across all primary shards on the specified nodes. Includes documents in Lucene segments and may count nested documents. | | indices.docs.deleted | Integer | The total number of deleted documents across all primary shards on the specified nodes. Disk space is reclaimed during segment merges. | | indices.store.size_in_bytes | Long | The total storage size of all shards on the specified nodes, in bytes. | | indices.store.reserved_in_bytes | Long | The amount of disk space reserved for ongoing operations such as segment merges, in bytes. | | indices.fielddata.memory_size_in_bytes | Long | The total amount of memory used by the field data cache across the specified nodes, in bytes. | | indices.fielddata.evictions | Long | The number of field data cache evictions across the specified nodes. | | indices.query_cache.memory_size_in_bytes | Long | The total amount of memory used by the query cache across the specified nodes, in bytes. | | indices.query_cache.total_count | Long | The total number of query cache accesses (hits and misses) across the specified nodes. | | indices.query_cache.hit_count | Long | The number of query cache hits across the specified nodes. | | indices.query_cache.miss_count | Long | The number of query cache misses across the specified nodes. | | indices.query_cache.cache_size | Integer | The current number of entries in the query cache across the specified nodes. | | indices.query_cache.cache_count | Long | The total number of entries added to the query cache, including evicted entries. | | indices.query_cache.evictions | Long | The number of query cache evictions across the specified nodes. | | indices.completion.size_in_bytes | Long | The total amount of memory used for completion suggesters across the specified nodes, in bytes. | | indices.segments | Object | Segment statistics for the specified nodes. | | indices.segments.count | Integer | The total number of segments across all shards on the specified nodes. | | indices.segments.memory_in_bytes | Long | The total amount of memory used by segments across the specified nodes, in bytes. | | indices.segments.terms_memory_in_bytes | Long | The amount of memory used for term dictionaries across the specified nodes, in bytes. | | indices.segments.stored_fields_memory_in_bytes | Long | The amount of memory used for stored fields across the specified nodes, in bytes. | | indices.segments.term_vectors_memory_in_bytes | Long | The amount of memory used for term vectors across the specified nodes, in bytes. | | indices.segments.norms_memory_in_bytes | Long | The amount of memory used for normalization factors across the specified nodes, in bytes. | | indices.segments.points_memory_in_bytes | Long | The amount of memory used for point values (numeric or geographic) across the specified nodes, in bytes. | | indices.segments.doc_values_memory_in_bytes | Long | The amount of memory used for doc values across the specified nodes, in bytes. | | indices.segments.index_writer_memory_in_bytes | Long | The amount of memory used by index writers across the specified nodes, in bytes. | | indices.segments.version_map_memory_in_bytes | Long | The amount of memory used by version maps across the specified nodes, in bytes. | | indices.segments.fixed_bit_set_memory_in_bytes | Long | The amount of memory used by fixed bit sets (for nested and join fields) across the specified nodes, in bytes. | | indices.segments.max_unsafe_auto_id_timestamp | Long | The most recent timestamp of a retried indexing request, in milliseconds. | | indices.segments.file_sizes | Object | This object is not populated by the Cluster Stats API. To get information on segment files, use the Nodes Stats API. | | indices.mappings.field_types | Array | Statistics about field data types used on the specified nodes. | | indices.mappings.field_types.name | String | The field data type. | | indices.mappings.field_types.count | Integer | The number of fields mapped to this data type. | | indices.mappings.field_types.index_count | Integer | The number of indexes that use this data type. | | indices.analysis | Object | Statistics about analyzers and analysis components used on the specified nodes. | | nodes | Object | Aggregated statistics for the specified nodes. | | nodes.count.total | Integer | The total number of nodes. | | nodes.count.coordinating_only | Integer | The number of nodes with no assigned roles (coordinating-only nodes). | | nodes.count. | Integer | The number of nodes with a specific role (for example, data, ingest, cluster_manager). | | nodes.versions | Array | The OpenSearch versions running on the specified nodes. | | nodes.os.available_processors | Integer | The total number of processors available to the JVM across the specified nodes. | | nodes.os.allocated_processors | Integer | The number of processors used for thread pool sizing across the specified nodes (capped at 32). | | nodes.os.mem.total_in_bytes | Long | The total physical memory across the specified nodes, in bytes. | | nodes.os.mem.free_in_bytes | Long | The amount of free physical memory across the specified nodes, in bytes. | | nodes.os.mem.used_in_bytes | Long | The amount of used physical memory across the specified nodes, in bytes. | | nodes.os.mem.free_percent | Integer | The percentage of free physical memory across the specified nodes. | | nodes.os.mem.used_percent | Integer | The percentage of used physical memory across the specified nodes. | | nodes.process.cpu.percent | Integer | The CPU usage percentage across the specified nodes. Returns -1 if not supported. | | nodes.process.open_file_descriptors.min | Integer | The minimum number of open file descriptors across the specified nodes. Returns -1 if not supported. | | nodes.process.open_file_descriptors.max | Integer | The maximum number of open file descriptors across the specified nodes. Returns -1 if not supported. | | nodes.process.open_file_descriptors.avg | Integer | The average number of open file descriptors across the specified nodes. Returns -1 if not supported. | | nodes.jvm.max_uptime_in_millis | Long | The maximum JVM uptime, in milliseconds, across the specified nodes. | | nodes.jvm.versions | Array | Statistics about JVM versions running on the specified nodes. | | nodes.jvm.mem.heap_used_in_bytes | Long | The heap memory currently in use across the specified nodes, in bytes. | | nodes.jvm.mem.heap_max_in_bytes | Long | The maximum heap memory available across the specified nodes, in bytes. | | nodes.jvm.threads | Integer | The total number of active JVM threads across the specified nodes. | | nodes.fs.total_in_bytes | Long | The total filesystem capacity across the specified nodes, in bytes. | | nodes.fs.free_in_bytes | Long | The total unallocated disk space across the specified nodes, in bytes. | | nodes.fs.available_in_bytes | Long | The disk space available to the JVM across the specified nodes (may be less than free space because of operating system restrictions), in bytes. | | nodes.plugins | Array | Information about installed plugins and modules on the specified nodes. | | nodes.network_types | Object | Statistics about transport and HTTP network types used by the specified nodes. | | nodes.discovery_types | Object | Statistics about discovery mechanisms used by the specified nodes. | | nodes.packaging_types | Array | Information about the distribution types installed on the specified nodes. | | nodes.ingest.number_of_pipelines | Integer | The total number of ingest pipelines across the specified nodes. | | nodes.ingest.processor_stats | Object | Statistics about ingest processors used on the specified nodes. |

필요한 권한

Security 플러그인을 사용한다면 적절한 권한이 있는지 확인해 주세요: cluster:monitor/stats.

더 알아보기 (Learn more)

클러스터 통계를 더 깊이 이해하고 싶다면 원문 OpenSearch 문서를 확인해 주세요.