简介
ES默认的分片数是1000,如果ES是集群模式的话,每多一个节点总分片数就多1000.假如我是四节点的ES,我的单es分片为每个节点1000,总分片是4000.
查询ES分片
#查看总分片
curl -XGET 'ES的IP:9200/_cluster/settings?include_defaults&flat_settings' | python -m json.tool | grep max_shards
#返回结果:
"cluster.max_shards_per_node": "1000"
#要么就是空值,空值默认为1000
#查看es节点总共使用了多少分片
curl -XGET http://ES的IP:9200/_cat/health?v
#shards就是使用了多少分片
#查看es集群每个节点使用了多少分片
curl ES的IP:9200/_cat/allocation?v
添加ES分片
#每个节点添加一万分片数
curl -XPUT -H "Content-Type:application/json" -d '{"persistent":{"cluster":{"max_shards_per_node":10000}}}' 'http:/ES的IP:9200/_cluster/settings'
##返回结果:
{"acknowledged":true,"persistent":{},"transient":{"cluster":{"max_shards_per_node":"10000"}}}
#以上表示成功,每个节点增加到了10000分片数