elasticseach 默认分片个数配置

环境说明:
es集群数据通过logstash写入数据,通过logstash建立后缀为时间的索引,通过时间后缀进行数据的定时删除操作。

出现问题:
由于是通过logstash自动创建索引,导致分片个数默认为5,副本分片默认为1。在节点个数大于分片个数的情况下,如果个别索引被分配到同一节点,就会导致数据读写性能不是最优,需要调整logstash自动创建索引时的分片个数。

解决办法:
参考:https://www.elastic.co/guide/en/elasticsearch/reference/7.x/config-monitoring-indices.html

使用logstash自动创建的索引是使用模板进行创建的,只需要对模板进行修改即可:

查看模板:

GET _template/logstash

通过put方法对模板进行修改

PUT _template/logstash
{
“index_patterns”: [
“logstash-*”
],
“settings”: {
“index”: {
“number_of_shards”: “20”,
“refresh_interval”: “5s”
}
}
}

延伸

默认使用logstash自动创建索引如下:

output {

elasticsearch {
    hosts => ["172.16.32.222:9200","172.16.32.223:9200"]
    index => "test-%{+YYYY.MM.dd}"
    user => "elastic"
     password => "xxxxxxx"
}

}

数据写入es时默认指定的配置 template_name 默认为 logstash,可以按照格式对logstash模板进行修改,或者建立自己的模板。

建议:(仅参考)

每一个分片数据文件小于30GB
每一个索引中的一个分片对应一个节点
节点数大于等于分片数

threadpool相关:
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-indexing-speed.html#_disable_refresh_and_replicas_for_initial_loads
https://elasticsearch.cn/book/elasticsearch_definitive_guide_2.x/dont-touch-these-settings.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-thread-pool.html

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Elasticsearch是一个开源的分布式搜索和分析引擎,可以用于实时将物流快递单等业务据增量同步至Elasticsearch索引中。它被广泛应用于各种场景,包括日志分析、全文搜索、据可视化等。根据引用中的信息,李猛是一位对Elasticsearch有深入体验的工程师,他对Elastic-Stack的开发、架构、运维等方面有丰富的经验,并且提供咨询、培训和调优实施等服务。 如果您想使用Elasticsearch,您需要启动Elasticsearch服务器和Kibana。启动Elasticsearch服务器可以使用版本2.1或更高版本。同时,您还可以使用Kibana来进行据可视化和仪表板的创建。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [一文快速了解Elastic Search 开源搜索引擎(技术选型+启动命令)](https://blog.csdn.net/xianyu120/article/details/117518586)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [ES既是搜索引擎又是据库?真的有那么全能吗?](https://blog.csdn.net/w397090770/article/details/108934868)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值