Elasticsearch 动态修改replica配置、增删replica

1. 获取当前所有index配置

curl -XGET http://localhost:9200/_settings

 

2. 获取某些index的配置

curl -XGET http://localhost:9200/test-*/_settings

 

3. 动态修改某些index配置,增加replica

curl -XPUT http://localhost:9200/test-*/_settings -d '{"replicas":1}'

 

4. 动态修改某些index配置,删除replica

curl -XPUT http://localhost:9200/test-*/_settings -d '{"replicas":0}'

 

实测新增replica速度很快,cpu占比不算高,远低于重新索引数据,基本接近远程复制文件的速度。有replica之后,logstash或es会有集群负载均衡,比如replica为1,基本primary和replica CPU占比均衡,性能上ES整体大约多耗用20%CPU,磁盘空间多耗用1倍。

posted on 2016-05-09 11:43  oceanking  阅读(3421)  评论(0编辑  收藏  举报