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
相關文章
相關標籤/搜索