반응형

Cluster 상태 모니터링

삭제 작업 중 Kibana의 Monitoring이나 /_cat/health API를 사용하여 클러스터 상태를 모니터링 할 수 있다

GET /_cat/health?v=true

curl 코드

curl -X GET "localhost:9200/_cat/health?v=true&pretty"

 

결과 예시

cluster       status node.total node.data shards pri relo init unassign unassign.pri pending_tasks max_task_wait_time active_shards_percent
elasticsearch green           1         1      1   1    0    0        0            0             0                  -                100.0%

 

상태(status)

- grenn : 모든 샤드가 정상적으로 작동 중

- yellow : 일부 복제본 샤드가 활성화되지 않았지만, 데이터는 사용 가능

- red : 일부 데이터 샤드가 손실된 상태

 

노드 상태 모니터링

GET /_nodes/stats

curl코드

curl -X GET "localhost:9200/_nodes/stats?pretty"

 

출력 예시

- CPU 사용량

- Heap 메모리 사용량

- 디스크 사용량 및 가용량

샤드 상태 모니터링

GET /_cat/shards?v

curl 코드

curl -X GET "localhost:9200/_cat/shards?v=true&pretty"

출력예시 : 

index       shard prirep state   docs  store ip            node
user_data   0     p      STARTED 10000 5mb   192.168.1.10 node-1
user_data   1     r      STARTED 10000 5mb   192.168.1.11 node-2

p : primary 샤드

r : replica 샤드

 

state : STARTED, RELOCATING, INITIALIZING, UNASSIGNED 등의 사앹 확인 가능

 

작업 큐 상태 확인

GET /_cat/thread_pool?v

curl 코드

crul -X GET "localhost:9200./_cat/shards?v=true&pretty"

출력 예시

node_id   name    active queue rejected
node-1    write   2      15    0
node-2    search  0      10    5

queue : 작업 대기열의 크기

rejected : 처리할 수 없어 거부된 작업 수(거부 작업이 많다면 리소스가 부족하다는 신호다)

 

_tasks를 통해 특정 작업 모니터링 하기(나의 경우 delete_by_query)

curl 코드

curl -X GET "localhost:9200/_tasks?detailed=true&actions=*/delete/byquery&pretty"

출력예시

{
  "nodes": {
    "node-1": {
      "tasks": {
        "node-1:12345": {
          "action": "indices:data/write/delete/byquery",
          "status": {
            "total": 100000,
            "deleted": 5000,
            "version_conflicts": 0,
            "throttled_millis": 0
          }
        }
      }
    }
  }
}

 

 

굿굿

 

반응형

+ Recent posts