码迷,mamicode.com
首页 > 其他好文 > 详细

elasticsearch 写入优化

时间:2018-11-13 20:21:40      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:int   pre   start   使用   http   elastics   inter   replicas   大小   

全量dump数据时,为优化性能,可做如下优化。

  1. 分片设置,不分片
http://localhost:9200/test_index/_settings/
{
  "index": {
    "number_of_replicas": 0
  }
}
  1. 刷新设置,不刷新
http://localhost:9200/test_index/_settings/
{
  "index": {
    "refresh_interval": "-1"
  }
}
  1. translog 大小设置,调大 默认512M
http://localhost:9200/test_index/_settings/
{
  "index.translog.flush_threshold_size": "1024mb"
}
  1. 如果是SSD硬盘,修改段合并速率
http://localhost:9200/_cluster/settings/
{
  "persistent": {
    "indices.store.throttle.max_bytes_per_sec": "200mb"
  }
}

http://localhost:9200/_cluster/settings/
{
  "transient": {
    "indices.store.throttle.type": "none"
  }
}

全量dump后,再恢复一下

  1. 分片设置
http://localhost:9200/test_index/_settings/
{
  "index": {
    "number_of_replicas": 5
  }
}
  1. 刷新设置,不刷新
http://localhost:9200/test_index/_settings/
{
  "index": {
    "refresh_interval": "1s"
  }
}
  1. translog 大小设置
http://localhost:9200/test_index/_settings/
{
  "index.translog.flush_threshold_size": "512mb"
}

当然应该使用bulk模式, elasticsearch单次提交数据尽量在15M以内。

elasticsearch 写入优化

标签:int   pre   start   使用   http   elastics   inter   replicas   大小   

原文地址:http://blog.51cto.com/12597095/2316433

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!