Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
547 views
in Technique[技术] by (71.8m points)

elasticsearch - How many shards per node?

How can I get information how many shards exists per node with specific id? I trying to find this information on the official documentation. But can't. One of the possible scenario it is get information about shards by this request and grouping by nodes:

GET /_cat/shards&v=true

index                      shard prirep state       docs store ip         node
people                     0     p      STARTED        1 4.4kb 172.17.0.2  1
blog                       0     p      STARTED        1 4.8kb 172.17.0.2  2
micrometer-metrics-2021-05 0     p      STARTED    14368   1mb 172.17.0.2  3

If you have any idea or thought please share with me.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You need to use the _cat/allocation API

GET /_cat/allocation/1?v

And you'll get the number of shards for the specified node:

shards disk.indices disk.used disk.avail disk.total disk.percent host       ip         node
   121        1.3tb     1.3tb    466.4gb      1.8tb           74 10.x.y.z   10.x.y.z   1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...