资讯详情

Elasticsearch多主、多数据、多协调、多冷节点说明及配置(一)

最近,由于客户项目的需要,我们进行了专门的研究Elasticsearch这些不常用的重要功能被整理成文档,现在分享,希望对有这方面需求的同行有所帮助

  1. Elasticsearch多主、多数据、多协调、多冷节点节点说明及配置
  2. Elasticsearch灾备同步方案设计
  3. Elasticsearch灾备同步方案设计验证

1. 多主

  • ElasticSearch默认情况下,任何节点都可以成为主节点,也可以手动设置节点成为主节点的候选节点,负责管理集群内的所有变化,如添加、删除索引或添加、删除节点等。
  • 主节点数据需要奇数,以便在主节点出现问题时选择新的主节点继续提供服务,以确保主节点的高可用性
  • 涉及到的elasticsearch.yml配置文件的主要配置项
cluster.name: "BoCloud_cluster" node.name: master_1 node.master: true http.port: 9200 transport.tcp.port: 9300 discovery.seed_hosts: ["dc_es1","dc_es2","dc_es3"] cluster.initial_master_nodes: ["dc_es1","dc_es2","dc_es3"]
  • 如果node.master、node.data 同时设置为true,如果节点可以参与选举主节点和数据节点node.master设置为true、node.data为false,节点只能参与选举主节点

2. 多数据

  • ElasticSearch数据节点主要是存储索引数据的节点,主要是添加、删除、更改和检查文档以及聚合。数据节点cpu,内存,io要求较高, 当资源不足时,需要在集群中添加新的数据节点。
  • 涉及到的elasticsearch.yml配置文件的主要配置项
cluster.name: "BoCloud_cluster" node.name: data_1 node.data: true http.port: 9200 transport.tcp.port: 9300 discovery.seed_hosts: ["dc_es1","dc_es2","dc_es3"] cluster.initial_master_nodes: ["dc_es1","dc_es2","dc_es3"]

3. 多协调

  • ElasticSearch默认每个node它们都是协调节点,但也允许手动设置协调节点。协调功能将客户端请求转移到最合适的节点进行处理。简言之,它们是负载平衡的功能。集群中每个节点的负载和健康状况不同。有些节点可能已经超载,有些节点甚至不健康。这些不健康的节点不应该再接受请求,否则会导致失败的响应。协调节点,了解集群中每个节点的状态。
  • 主要提到协调节点的作用
  • 涉及到的elasticsearch.yml配置文件的主要配置项
cluster.name: "BoCloud_cluster" node.name: condition_1 node.data: false node.master: false node.ingest: true http.port: 9200 transport.tcp.port: 9300 discovery.seed_hosts: ["dc_es1","dc_es2","dc_es3"] cluster.initial_master_nodes: ["dc_es1","dc_es2","dc_es3"]
  • 协调节点的数量没有限制,但建议是奇数,也可以根据实际情况进行调整

4. 多冷节点

  • 冷节点用于不经常访问的冷节点read-only索引。功能类似于数据库的只读库。 当索引不再频繁查询时,不常用的数据可以通过设置冷热数据转移到冷节点,ElasticSearch将索引合并到冷节点。同时,也可以在配置文件中设置 index.codec: best_compression 确保冷节点的数据压缩,减少空间
  • 冷节点建议与热节点数据节点相等
  • 涉及到的elasticsearch.yml配置文件的主要配置项
cluster.name: "BoCloud_cluster" node.name: warm_1 node.data: true http.port: 9200 node.attr.box_type:warm transport.tcp.port: 9300 discovery.seed_hosts: ["dc_es1","dc_es2","dc_es3"] cluster.initial_master_nodes: ["dc_es1","dc_es2","dc_es3"]
  • 数据节点类型可以通过node.attr.box_type设置warm、hot在创建冷热数据节点的同时,值得标记index通过指定索引数据保存到数据节点的类型index索引配置文件index.routing.allocation.require.box_type设置数据存储节点
{   "settings": {     "index.routing.allocation.require.box_type": "hot",    "index.number_of_replicas": "0"  }  }
  • 当索引数据不再经常索引时,属性值可以是warm将数据转存到冷节点

标签: 贴片恢复二极管es1jsod

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

 锐单商城 - 一站式电子元器件采购平台  

 深圳锐单电子有限公司