返回提示词目录第 1383 页

规划搜索集群分片与容量

根据数据量、保留周期与查询需求估算分片和节点容量,生成索引模板及生命周期配置。

完整提示词

<context>
Shard count is the decision most Elasticsearch and OpenSearch clusters get wrong, and it cannot be changed on an existing index without a reindex, split or shrink. Too many small shards (daily indices with five primaries for a few megabytes of logs) waste heap and cluster state, slow recovery and eventually hit per-node shard limits. Too few huge shards slow recovery and rebalancing and limit indexing parallelism. Common guidance is shards of roughly 10 to 50 GB, keeping total shards per node bounded relative to heap, but the right size depends on the version and workload: search-heavy catalogues favour smaller shards and more replicas for query throughput; log and time-series data favours rollover by size or age through data streams and lifecycle policies (ILM in Elasticsearch, ISM in OpenSearch) that move data through hot, warm, cold and delete phases. Replicas add resilience and read capacity but double disk and indexing work. Mappings matter too: indexing every field of logs with dynamic mapping inflates storage. Capacity must include replicas, overhead and the disk watermarks, which stop allocation when disks fill past set percentages.
</context>

<task>
Workload: {{workload}}
{{#cluster}}Cluster: {{cluster}}{{/cluster}}

1. Restate the workload as numbers: daily primary data size after indexing (estimate the ratio of index size to raw size if unknown, and say so), retention, total primary and replica storage, query rate and latency target. List assumptions.
2. Choose the index strategy: time-based data streams or rollover indices for append-only data, or a single index (with an alias for future reindexing) for a catalogue or documents that are updated.
3. Calculate primaries per index and replicas: target shard size, rollover conditions (max primary shard size and max age), total shard count at full retention, and shards per node against heap and the version's limits.
4. Define lifecycle phases with actions (rollover, force merge, shrink, move to warm or cold nodes, searchable snapshots if licensed or available, delete) and timings from retention needs.
5. Size nodes: disk with headroom under the watermarks, heap, and node count for the hot tier and others; say where the estimate is weakest.
6. If the cluster exists, read its stats and list concrete fixes: indices to shrink or merge, templates to change for new indices, oversized indices to split (split API or reindex), mapping bloat to address, and the order to do them safely.
</task>

<constraints>
- Do not run reindex, shrink, delete or setting changes on a cluster yourself; produce requests for the user.
- Say whether each setting applies to Elasticsearch, OpenSearch or both, and to which versions, since lifecycle features and licences differ.
- Do not present rules of thumb as guarantees; recommend validating with a benchmark on representative data and queries.
</constraints>

<output_format>
## Sizing summary
Primaries, replicas, rollover, total shards, nodes and storage in a short table.
## Calculation
The arithmetic with assumptions.
## Index and lifecycle settings
Index template and lifecycle policy as JSON blocks.
## Changes for the existing cluster
Ordered steps, or "Greenfield".
## Open questions
Numbered, or "None".
</output_format>

可替换内容

  • {{workload}}
  • {{#cluster}}
  • {{cluster}}
  • {{/cluster}}

分类与标签

编程开发、搜索集群、分片规划、容量估算、索引生命周期

前往 AI 图片创作