ES集群分片及副本调整

分片shardsnode

ES是个分布式的搜索引擎, 因此索引一般都会分解成不一样部分, 而这些分布在不一样节点的数据就是分片. 
ES自动管理和组织分片, 并在必要的时候对分片数据进行再平衡分配

副本replicasjson

为了提高访问压力过大是单机没法处理全部请求的问题,Elasticsearch集群引入了副本策略replica。副本策略对index中的每一个分片建立冗余的副本,
处理查询时能够把这些副本当作主分片来对待(primary shard),此外副本策略提供了高可用和数据安全的保障,当分片所在的机器宕机,
Elasticsearch能够使用其副本进行恢复,从而避免数据丢失。

调整分片和副本原则安全

A:索引不存在时,能够自定义副本和分片数
B:索引存在,则只能修改副本

调整分片和副本经常使用命令bash

curl -H "Content-Type: application/json" -XPUT 'http://10.10.10.53:9200/test5/' -d'{"settings":{"number_of_shards":3,"number_of_replicas":0}}'
curl -H "Content-Type: application/json" -XPUT 'http://10.10.10.46:9200/blog' -d'{"settings": {"number_of_shards":3,"number_of_replicas":2}}';
curl -H "Content-Type: application/json" -XPUT 'http://10.10.10.53:9200/test4/_settings' -d'{"index":{"number_of_replicas":3}}'

查看集群node 信息app

curl -XGET http://10.10.10.46:9200/_cat/nodes?pretty

查看集群索引curl

curl -XGET http://10.10.10.46:9200/_cat/indices?pretty
相关文章
相关标签/搜索