NOC online · 24/7Longview, TX · +1 323 412 0665
KinetikatechServers · Security · Websites
KO

이 심층 가이드는 영어로 제공됩니다.

English version

Self-Hosted Open Source Infrastructure

OpenSearch Shard Optimization: Managing Petabyte-Scale Log Indexes Without Cluster Performance Degradation

OpenSearch clusters degrade when shard count grows unchecked. Too many small shards waste memory and CPU; too few large shards create hotspots. At petabyte scale, shard strategy determines whether the cluster survives. This guide optimizes shards for log workloads.

핵심 내용

  1. Size shards deliberately. Target 10-50 GB per shard; smaller shards waste overhead, larger ones slow recovery.
  2. Use time-based indices. Daily or weekly indices match log ingestion patterns and simplify retention.
  3. Limit shard count. Keep total shards under a few thousand per node to avoid memory pressure.
  4. Configure ILM policies. Automate rollover, shrink, and delete to control shard growth.
  5. Use forcemerge on old indices. Merging segments reduces memory and improves query speed.
  6. Monitor shard allocation. Uneven distribution creates hot nodes; use allocation awareness.
  7. Tune refresh intervals. Longer intervals reduce indexing overhead for high-throughput logs.
  8. Plan capacity. Calculate shard count from data volume and retention before deploying.

Architecture

Logs flow into time-based indices, each with a configured number of primary shards. ILM policies rollover when size or age thresholds are met, shrink old indices, and delete expired data. Shard allocation balances across nodes, and forcemerge compacts segments.

Production configuration

ILM policy for log indices json
{
  "policy": {
    "description": "Log retention policy",
    "default_state": "hot",
    "states": [
      {"name": "hot", "actions": [{"rollover": {"max_size": "50gb", "max_age": "1d"}}], "transitions": [{"state_name": "warm", "conditions": {"min_age": "1d"}}]},
      {"name": "warm", "actions": [{"forcemerge": {"max_num_segments": 1}}, {"shrink": {"number_of_shards": 1}}], "transitions": [{"state_name": "delete", "conditions": {"min_age": "30d"}}]},
      {"name": "delete", "actions": [{"delete": {}}]}
    ]
  }
}
Create index template bash
curl -X PUT 'localhost:9200/_index_template/logs' -H 'Content-Type: application/json' -d '{
  "index_patterns": ["logs-*"],
  "template": {
    "settings": {
      "number_of_shards": 3,
      "number_of_replicas": 1,
      "refresh_interval": "30s"
    }
  }
}'
Monitor shard health bash
curl -s 'localhost:9200/_cat/shards?v&h=index,shard,prirep,state,docs,store' | head -20
curl -s 'localhost:9200/_cluster/health?pretty'
curl -s 'localhost:9200/_cat/nodes?v&h=name,shards'

Edge cases from production

  • Rollover requires an alias; ensure the write alias points to the current index.
  • Shrinking changes shard count; queries must handle the new topology.
  • Forcemerge on large indices is I/O intensive; schedule during low traffic.
  • Replica shards double storage; balance cost against availability needs.

자주 묻는 질문

How many shards per node?

Keep total shards under a few thousand per node; memory is the limiting factor.

Should I use daily or weekly indices?

Daily for high-volume logs, weekly for lower volume; match to your data rate.

What happens if I have too many shards?

Memory pressure, slow queries, and cluster instability.

Can I change shard count after creation?

No, you must reindex; plan shard count before going live.

How do I reduce shard count?

Use shrink or reindex to consolidate into fewer shards.

self-hosted open source infrastructure에 대한 Kinetikatech의 지원

저희는 이것을 수백 번 처리했습니다: Running sovereign collaboration, storage, and identity stacks on hardware you control. 서버 관리 및 웹사이트 유지보수와 함께하면 평가, 구현, 24시간 연중무휴 모니터링, 그리고 중요한 때에 30분 이내 대응이라는 완전한 사이클을 제공합니다.

엔지니어와 상담하기

서버 문제? 해킹된 웹사이트? 느린 페이지?

심각한 장애에 30분 이내 대응 — 24시간, 주 7일.

긴급 지원 요청 support@kinetikatech.com