반응형
Cluster Health 체크
curl -u <user>:<passwd> -XGET 127.0.0.1:9200/_cluster/health?pretty
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 314,
"active_shards" : 314,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 295,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 51.55993431855501
}
status가 yellow 인 이유는 node가 1개 이고 할당된 replica shard 가 없기 때문이다.
replica 수를 강제로 0으로 설정하면 status 가 green으로 변경된다.
curl -XPUT 'localhost:9200/_settings?pretty' -H 'Content-Type: application/json' -d '{"index":{"number_of_replicas": 0}}'
참조 : https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html
index 조회
curl -u <user>:<passwd> -XGET 127.0.0.1:9200/_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open filebeat-2024.06.06 1T7dKzhKS8ao7aQyyn70Cg 1 1 0 0 226b 226b
yellow open filebeat-3-2024.05.29 CjtI53Sd-bVI2TTsTv4A 1 1 0 0 226b 226b
각 index 별로 primary shard와 replica shard가 각각 한개씩 설정되어있다. 실제로 할당된것은 아니며 실제 할당은 shard 조회를 통해 확인 할 수 있다.
참조 : https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html
shard 조회
curl -u <user>:<passwd> -XGET 127.0.0.1:9200/_cat/shards?v
filebeat-2024.06.06 0 p STARTED 0 226b 1.1.1.1 testhost
filebeat-2024.06.06 0 r UNASSIGNED
primary shard는 할당되었지만 replica shard는 할당되어 있지 않다.
특정 index의 shard 정보를 확인하려면 :
curl -XGET 127.0.0.1:9200/_cat/shards/<index>?v
참조 : https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html
shard가 할당된 디스크 및 node 정보
curl -u <user>:passwd> -XGET 127.0.0.1:9200/_cat/allocation?v
shards disk.indices disk.used disk.avail disk.total disk.percent host ip node
314 107.9gb 124.7gb 73.2gb 197.9gb 62 1.1.1.1 1.1.1.1 testhost
295 UNASSIGNED
cluster health 에서 ""active_primary_shards" : 314" 와 "unassigned_shards" : 295 의 할당 디스크 및 node 정보를 확인할 수 있다.
참조 : https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html
Node 정보
curl -u <user>:passwd> -XGET '127.0.0.1:9200/_cat/nodes?v=true'
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.16.10.1 3 59 2 0.01 0.16 0.23 cdfhilmrstw * test-ES01
172.16.10.2 3 60 0 0.01 0.14 0.16 cdfhilmrstw - test-ES02
172.16.10.3 3 61 0 0.01 0.12 0.14 cdfhilmrstw - test-ES03
Query parameters
curl -u <user>:passwd> -XGET '127.0.0.1:9200/_cat/nodes?v=true&h=<parameters>'
curl -XGET 'http://172.16.10.1:9200/_cat/nodes?v=true&h=id,cpu,uptime,disk.used_percent,heap.current'
id cpu uptime disk.used_percent heap.current
OCbV 1 36m 6.47 248mb
lRjs 1 35.7m 6.47 352mb
kjhJ 1 35.3m 6.52 857.5mb
참조 : https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html#cat-nodes-api-query-params
반응형
'Monitoring Tools > ELK Stack' 카테고리의 다른 글
11. metricbeat 설치(windows agent) (0) | 2022.05.06 |
---|---|
10. xpack security 적용 (0) | 2022.04.26 |
8. Windows Sysmon + Winlogbeat + logstash (0) | 2022.04.26 |
7. Elastalert (0) | 2022.04.26 |
6.2 filebeat offset 초기화 (0) | 2022.04.22 |