说说Elasticsearch那点事

ElasticSearch节点设置

2020-03-12  本文已影响0人  饿虎嗷呜

基础设置

本节参考文档:https://www.elastic.co/guide/en/elasticsearch/reference/7.2/modules-network.html

ES节点的基础信息包含下列几项:

节点角色设置

本节对应官方文档在此:https://www.elastic.co/guide/en/elasticsearch/reference/7.2/modules-node.html

在目前版本,ES节点有下面几种设置:

同时,本文也不考虑跨集群搜索的情况。

实际应用中会存在下面几种组合:

  1. Master Eligible Node

独立的master节点,专门用于集群的管理和编排。一般设置:

node.master: true
node.data: false
node.ingest: false
node.ml: false
xpack.ml.enabled: false
cluster.remote.connection: false

由于数据节点一般会承受更大的压力,为了让master节点稳定,该节点一般不承担数据接收和处理工作。

  1. Data Node

专门负责数据处理与存储的节点。

node.master: false
node.data: true
node.ingest: false
node.ml: false
xpack.ml.enabled: false
cluster.remote.connection: false
  1. Ingest Node

专门负责处理请求,只有node.ingest会设成true

node.master: false
node.data: false
node.ingest: true
node.ml: false
xpack.ml.enabled: false
cluster.remote.connection: false
  1. Coordinating Node

专门负责对请求进行分配,所有参数设成false即可。Coordinating Node在集群中的作用相当于负载均衡器。

node.master: false
node.data: false
node.ingest: false
node.ml: false
xpack.ml.enabled: false
cluster.remote.connection: false

冷热节点设置

ES可以根据目的,为节点打上不同的标签,比如冷热节点,机架号等。

相关参数:

node.attr.xxx: tag

比如说,我要设置一个节点为热节点,同时在机架1上可以这样配置:

node.attr.box_type: hot
node.attr.rack: rack1

同时需要配置索引属性:

"index.routing.allocation.require.box_type": "hot"
"index.routing.allocation.require.rack": "rack1"

启动

一般情况下,这时在ES安装目标直接执行bin/elasticsearch -d就可以启动节点了,在启动时也可以用命令行-E xxxx=xxx的方式覆盖elasticsearch.yml中的配置。

上一篇下一篇

猜你喜欢

热点阅读