DBAtlas · 数据库运维图谱

审查分片大小和分片数(过度分片/超大分片检测)

Elasticsearch维护

命令

# Largest shards (GB):
GET _cat/shards?v&h=index,shard,prirep,state,docs,store,node&s=store:desc&bytes=gb
# Indices by primary size:
GET _cat/indices?v&h=index,pri,rep,docs.count,pri.store.size,store.size&s=pri.store.size:desc&bytes=gb
# Shard count and disk per node:
GET _cat/allocation?v&h=node,shards,disk.indices,disk.percent&s=shards:desc
GET _cluster/stats?filter_path=indices.shards.total,indices.shards.primaries,nodes.count.data
GET _cluster/settings?include_defaults=true&filter_path=*.cluster.max_shards_per_node

作用

列出最大的分片、索引的主分片大小、每个节点的分片数、分片总数以及 cluster.max_shards_per_node 限制。

适用场景

容量规划期间、恢复时间变长或 heap 压力上升时,以及出现错误 'this action would add [x] shards, but this cluster currently has [y]/[z] maximum normal shards open' 时。

注意

大量很小的分片(过度分片)会给主节点和 heap 带来压力;很大的分片会使恢复和再平衡耗时数小时。索引创建后主分片数无法更改;需要 shrink、split 或 reindex 来修正。提高 max_shards_per_node 只是去掉限制,并不能解决问题。

在 DBAtlas 中打开 →

相关内容