Elasticsearch集群配置-节点职责划分 Hot Warm 架构实践

前言

本文主要讲了ES在节点部署时可以考虑的节点职责划分,如果不考虑节点部署,那么所有节点都会身兼数职(master-eligible ,data,coordinate等),这对后期的维护拓展并不利,所以本文从节点介绍出发,再到实践Hot Warm 架构,让大家有个es集群分职责部署有个直观印象。然后仍要着重强调,本文只是一个引子,只是告诉你ES有这个东西,当看完本文,以后的所有问题都应该直接去看 Elasticsearc-Nodes 官方文档介绍,ES完善的文档内容已经能够解决大部分问题,下方很多节点介绍也直接是文档原文整理了一下,都没有翻译,一开始本来想翻译的,后面想想完全没有必要,程序猿看英文文档不是很正常吗,哈哈。

一个节点只承担一个角色(Elasticsearch 8.14.3)

节点职责

You define a node’s roles by setting node.roles in elasticsearch.yml. If you set node.roles, the node is only assigned the roles you specify. If you don’t set node.roles, the node is assigned the following roles:

  • master
  • data
  • data_content
  • data_hot
  • data_warm
  • data_cold
  • data_frozen
  • ingest
  • ml
  • remote_cluster_client
  • transform

If you set node.roles, ensure you specify every node role your cluster needs. Every cluster requires the following node roles:

  • master
  • (data_content and data_hot) OR data
Master-eligible node

The master node is responsible for lightweight cluster-wide actions,It is important for cluster health to have a stable master node

  • creating or deleting an index
  • tracking which nodes are part of the cluster
  • deciding which shards to allocate to which nodes

To create a dedicated master-eligible node, set:

node.roles: [ master ]
Coordinating Node

Requests like search requests or bulk-indexing requests may involve data held on different data nodes. A search request, for example, is executed in two phases which are coordinated by the node which receives the client request — the coordinating node.

  1. In the scatter phase, the coordinating node forwards the request to the data nodes which hold the data. Each data node executes the request locally and returns its results to the coordinating node.
  2. In the gather phase, the coordinating node reduces each data node’s results into a single global result set.

Every node is implicitly a coordinating node. This means that a node that has an explicit empty list of roles via node.roles will only act as a coordinating node, which cannot be disabled. As a result, such a node needs to have enough memory and CPU in order to deal with the gather phase.

To create a dedicated coordinating node, set:

node.roles: [ ]
Data Node

Data nodes hold the shards that contain the documents you have indexed. Data nodes handle data related operations like CRUD, search, and aggregations. These operations are I/O-, memory-, and CPU-intensive. It is important to monitor these resources and to add more data nodes if they are overloaded.

In a multi-tier deployment architecture, you use specialized data roles to assign data nodes to specific tiers: data_content,data_hot, data_warm, data_cold, or data_frozen. A node can belong to multiple tiers.

If you want to include a node in all tiers, or if your cluster does not use multiple tiers, then you can use the generic data role.

Generic data node

Generic data nodes are included in all content tiers.

To create a dedicated generic data node, set:

node.roles: [ data ]
Content data node

Content data nodes are part of the content tier. Data stored in the content tier is generally a collection of items such as a product catalog or article archive. Content data typically has long data retention requirements, and you want to be able to retrieve items quickly regardless of how old they are. Content tier nodes are usually optimized for query performance—​they prioritize processing power over IO throughput so they can process complex searches and aggregations and return results quickly.

The content tier is required and is often deployed within the same node grouping as the hot tier. System indices and other indices that aren’t part of a data stream are automatically allocated to the content tier.

To create a dedicated content node, set:

node.roles: ["data_content"]
Hot data node

Hot data nodes are part of the hot tier. The hot tier is the Elasticsearch entry point for time series data and holds your most-recent, most-frequently-searched time series data. Nodes in the hot tier need to be fast for both reads and writes, which requires more hardware resources and faster storage (SSDs). For resiliency, indices in the hot tier should be configured to use one or more replicas.

The hot tier is required. New indices that are part of a data stream are automatically allocated to the hot tier.

To create a dedicated hot node, set:

node.roles: [ "data_hot" ]
Warm data node

Warm data nodes are part of the warm tier. Time series data can move to the warm tier once it is being queried less frequently than the recently-indexed data in the hot tier. The warm tier typically holds data from recent weeks. Updates are still allowed, but likely infrequent. Nodes in the warm tier generally don’t need to be as fast as those in the hot tier. For resiliency, indices in the warm tier should be configured to use one or more replicas.

To create a dedicated warm node, set:

node.roles: [ "data_warm" ]
Cold data node

Cold data nodes are part of the cold tier. When you no longer need to search time series data regularly, it can move from the warm tier to the cold tier. While still searchable, this tier is typically optimized for lower storage costs rather than search speed.

For better storage savings, you can keep fully mounted indices of searchable snapshots on the cold tier. Unlike regular indices, these fully mounted indices don’t require replicas for reliability. In the event of a failure, they can recover data from the underlying snapshot instead. This potentially halves the local storage needed for the data. A snapshot repository is required to use fully mounted indices in the cold tier. Fully mounted indices are read-only.

Alternatively, you can use the cold tier to store regular indices with replicas instead of using searchable snapshots. This lets you store older data on less expensive hardware but doesn’t reduce required disk space compared to the warm tier.

To create a dedicated cold node, set:

node.roles: [ "data_cold" ]
Frozen data node

Frozen data nodes are part of the frozen tier. Once data is no longer being queried, or being queried rarely, it may move from the cold tier to the frozen tier where it stays for the rest of its life.

The frozen tier requires a snapshot repository. The frozen tier uses partially mounted indices to store and load data from a snapshot repository. This reduces local storage and operating costs while still letting you search frozen data. Because Elasticsearch must sometimes fetch frozen data from the snapshot repository, searches on the frozen tier are typically slower than on the cold tier.

To create a dedicated frozen node, set:

node.roles: [ "data_frozen" ]

WARNING: Adding too many coordinating only nodes to a cluster can increase the burden on the entire cluster because the elected master node must await acknowledgement of cluster state updates from every node! The benefit of coordinating only nodes should not be overstated — data nodes can happily serve the same purpose.

Ingest Node

数据前置处理转换节点,支持pipeline管道设置,可以使用ingest对数据进行过滤、转换等操作

Hot Warm 架构实践

部署3个master-eligible节点, 2个coordinate only node,2个data-content(充当warm节点),3个data-hot。这些基本算是如果要做节点职责划分的最小配置。

在这里插入图片描述

  • 单一 master eligible nodes: 负责集群状态(cluster state)的管理
    • 使用低配置的CPU,RAM和磁盘
  • 单一 data nodes: 负责数据存储及处理客户端请求
    • 使用高配置的CPU,RAM和磁盘
  • 单一ingest nodes: 负责数据处理
    • 使用高配置CPU; 中等配置的RAM; 低配置的磁盘
  • 单一Coordinating Only Nodes(Client Node)
    • 使用高配置CPU; 高配置的RAM; 低配置的磁盘
Docker安装脚本
docker network create elasticdocker run -d ^--name es-master-01 ^--hostname es-master-01 ^--restart unless-stopped ^--net elastic ^-p 9200:9200 ^-e node.name=es-master-01 ^-e node.roles=["master"]  ^-e cluster.initial_master_nodes=es-master-01,es-master-02,es-master-03 ^-e discovery.seed_hosts=es-master-02,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-master-01\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3docker run -d ^--name es-master-02 ^--hostname es-master-02 ^--restart unless-stopped ^--net elastic ^-p 9201:9200 ^-e node.name=es-master-02 ^-e node.roles=["master"]  ^-e cluster.initial_master_nodes=es-master-01,es-master-02,es-master-03 ^-e discovery.seed_hosts=es-master-01,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-master-02\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3docker run -d ^--name es-master-03 ^--hostname es-master-03 ^--restart unless-stopped ^--net elastic ^-p 9202:9200 ^-e node.name=es-master-03 ^-e node.roles=["master"]  ^-e cluster.initial_master_nodes=es-master-01,es-master-02,es-master-03 ^-e discovery.seed_hosts=es-master-01,es-master-02 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-master-03\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3  docker run -d ^--name es-coordinating-only-01 ^--hostname es-coordinating-only-01 ^--restart unless-stopped ^--net elastic ^-p 9210:9200 ^-e node.name=es-coordinating-only-01 ^-e node.roles=[]  ^-e discovery.seed_hosts=es-master-01,es-master-02,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-coordinating-only-01\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3  docker run -d ^--name es-coordinating-only-02 ^--hostname es-coordinating-only-02 ^--restart unless-stopped ^--net elastic ^-p 9211:9200 ^-e node.name=es-coordinating-only-02 ^-e node.roles=[]  ^-e discovery.seed_hosts=es-master-01,es-master-02,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-coordinating-only-02\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3  docker run -d ^--name es-data-hot-01 ^--hostname es-data-hot-01 ^--restart unless-stopped ^--net elastic ^-p 9220:9200 ^-e node.name=es-data-hot-01 ^-e node.roles=["data_hot"]  ^-e discovery.seed_hosts=es-master-01,es-master-02,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-data-hot-01\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3  docker run -d ^--name es-data-hot-02 ^--hostname es-data-hot-02 ^--restart unless-stopped ^--net elastic ^-p 9221:9200 ^-e node.name=es-data-hot-02 ^-e node.roles=["data_hot"]  ^-e discovery.seed_hosts=es-master-01,es-master-02,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-data-hot-02\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3  docker run -d ^--name es-data-hot-03 ^--hostname es-data-hot-03 ^--restart unless-stopped ^--net elastic ^-p 9222:9200 ^-e node.name=es-data-hot-03 ^-e node.roles=["data_hot"]  ^-e discovery.seed_hosts=es-master-01,es-master-02,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-data-hot-03\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3  docker run -d ^--name es-data-content-01 ^--hostname es-data-content-01 ^--restart unless-stopped ^--net elastic ^-p 9230:9200 ^-e node.name=es-data-content-01 ^-e node.roles=["data_content"]  ^-e discovery.seed_hosts=es-master-01,es-master-02,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-data-content-01\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3  docker run -d ^--name es-data-content-02 ^--hostname es-data-content-02 ^--restart unless-stopped ^--net elastic ^-p 9231:9200 ^-e node.name=es-data-content-02 ^-e node.roles=["data_content"]  ^-e discovery.seed_hosts=es-master-01,es-master-02,es-master-03 ^-e cluster.name=docker-cluster ^-e xpack.security.enabled=false ^-v C:\Users\wayne\docker\elasticsearch\docker-cluster\es-data-content-02\data:/usr/share/elasticsearch/data ^-m 1GB ^docker.elastic.co/elasticsearch/elasticsearch:8.14.3  
create index template
PUT /_index_template/books_template HTTP/1.1
Host: 123.123.8.2:9210
Content-Type: application/json
Content-Length: 887
{"index_patterns" : ["books"],"template": {"settings": {"index": {"number_of_shards": "1","number_of_replicas": "1","routing": {"allocation": {"include": {// 写入data_hot节点"_tier_preference": "data_hot"}}}}},"mappings": {"properties": {"author": {"type": "text"},"page_count": {"type": "integer"},"name": {"type": "text"},"release_date": {"type": "date"}}}}
}
add a data
POST /books/_doc HTTP/1.1
Host: 123.123.8.2:9210
Content-Type: application/json
Content-Length: 123{"name": "Snow Crash","author": "Neal Stephenson","release_date": "1992-06-01","page_count": 470
} 

在这里插入图片描述

Set a tier preference for existing indices (move index to other data node)

你可以使用ilm机制去自动迁移index,这里只是演示http请求手动迁移books索引从data_hot节点到data_content节点。

PUT /books/_settings HTTP/1.1
Host: 123.123.8.2:9210
Content-Type: application/json
Content-Length: 79{"index.routing.allocation.include._tier_preference": "data_content"
}

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/1487592.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

Gitops-Argo-Cli安装与使用

一、安装Argo-Cli工具 Release v2.9.21 argoproj/argo-cd GitHub **选择合适的符合你操作系统以及CPU架构的二进制文件 #依v2.9.21-X86-64-Linux操作系统为例 wget https://github.com/argoproj/argo-cd/releases/download/v2.9.21/argocd-linux-amd64 #添加执行权限并且移…

景区AR导航营销系统:技术解决方案与实施效益分析

随着旅游市场的竞争日益激烈,景区需要不断创新以吸引游客。景区 AR 导航将虚拟画面与现实场景相结合,为游客提供了更加直观、生动的导航服务。对于景区而言,这一创新技术无疑是吸引游客目光、提升景区知名度的有力武器。通过独特的 AR 导航体…

计算机网络-配置路由器ACL(访问控制列表)

配置访问控制列表ACL 拓扑结构 拓扑结构如下: 要配置一个ACL,禁止PC0访问PC3,禁止PC4访问PC0,其它正常。 配置Router0 配置接口IP地址: interface fastethernet 0/0 ip address 192.168.1.1 255.255.255.0 no shu…

elmentui this.$confirm使用模板字符串构建HTML结构

tip(){const checkingList [];const findList[入会1,入会2,入会3] //数组const sueccList [{name:入会,suecc:1000,numcot:1000},{name:aaaaa,suecc:222,numcot:3333}] //数组对象var message// 使用模板字符串构建HTML结构if(sueccList.length>0){message <div>…

缓存穿透,缓存击穿,缓存雪崩

目录 介绍 缓存穿透 缓存击穿 缓存雪崩 原因 影响 解决方案 缓存穿透 防止缓存穿透->空值缓存案例 缓存击穿 使用互斥锁解决缓存击穿 介绍 缓存穿透 定义&#xff1a;缓存穿透是指用户查询数据&#xff0c;缓存和数据库中都不存在该数据&#xff08;一般是发起恶意…

Mac应用快速启动器:Alfred 5 for Mac 激活版

Alfred 5 是一款专为 macOS 系统设计的效率提升工具。这款软件以其快速启动和高效操作功能著称&#xff0c;通过使用快捷键来呼出输入界面&#xff0c;用户可以快速完成各种任务。 最新版本 Alfred 5.5 引入了一些新功能。其中包括整合了 ChatGPT 和 DALL-E&#xff0c;这意味…

linux root登陆,密码正确但,错误提示su: Authentication failure

初开始登陆的时候会显示失败&#xff0c;参考了很多网上的做法&#xff0c;但还是不行&#xff0c;但是&#xff0c;如果用键盘左边那一排数字按键输入&#xff0c;就可以正常登陆&#xff08;之前用的是右边的九宫格&#xff09;

Mindspore框架循环神经网络RNN模型实现情感分类|(四)损失函数与优化器

Mindspore框架循环神经网络RNN模型实现情感分类 Mindspore框架循环神经网络RNN模型实现情感分类|&#xff08;一&#xff09;IMDB影评数据集准备 Mindspore框架循环神经网络RNN模型实现情感分类|&#xff08;二&#xff09;预训练词向量 Mindspore框架循环神经网络RNN模型实现…

图论之求树的重心

文章目录 题目简要分析解题思路代码实现 题目 原题链接&#xff1a;https://www.acwing.com/problem/content/848/ 题目描述 给定一颗树&#xff0c;树中包含 n 个结点&#xff08;编号 1∼n&#xff09;和 n−1条无向边。请你找到树的重心&#xff0c;并输出将重心删除后&am…

钉钉 ai卡片 stream模式联调

sdk连接 新建卡片模板下载node.js sdkconfig.json 配置应用信息 启动项目npm i npm run build npm run start连接成功 获取卡片回调 注册卡片回调事件调用https://api.dingtalk.com/v1.0/card/instances 创建卡片实例&#xff0c;返回实例Id //参数结构 {"cardTempla…

Linux文件与相关函数的知识点1

Open函数 高频使用的Linux系统调用&#xff1a;open write read close Linux 自带的工具&#xff1a;man手册&#xff1a; man 1是普通的shell命令&#xff0c;比如ls 调用命令&#xff1a;man 1 ls man 2是系统调用函数&#xff0c;比如open&#xff0c;write 调用open…

AV1技术学习:Quantization

量化是对变换系数进行&#xff0c;并将量化索引熵编码。AV1的量化参数 QP 的取值范围是0 ~ 255。 一、Quantization Step Size 在给定的 QP 下&#xff0c;DC 系数的量化步长小于 AC 系数的量化步长。DC 系数和 AC 系数从 QP 到量化步长的映射如下图所示。当 QP 为 0 时&…

MySQL的高可用(MHA)

高可用模式下的故障切换&#xff0c;基于主从复制。 单点故障和主从复制不能切换的问题。 至少需要三台。 故障切换过程0-30秒 vip地址&#xff0c;根据vip地址所在的主机&#xff0c;确定主备。 主 vip 备 vip 主和备不是优先级确定的&#xff0c;主从复制的时候就确定…

BGP之选路MED

原理概述 当一台BGP路由器中存在多条去往同一目标网络的BGP路由时&#xff0c;BGP协议会对这些BGP路由的属性进行比较&#xff0c;以确定去往该目标网络的最优BGP路由。BGP路由属性的比较顺序为Preferred Value属性、Local Preference属性、路由生成方式、AS_Path属性、Origin属…

一款简而轻的项目运维监控软件,支持低侵入式在线构建、自动部署、日常运维(附源码)

前言 在当今快速发展的软件开发领域&#xff0c;开发团队经常面临一系列运维挑战。没有专业运维人员的支持&#xff0c;开发人员不得不承担构建和部署项目的任务。 面对不同项目的构建和部署命令&#xff0c;以及多环境的打包需求&#xff0c;开发人员需要一个能够简化这些流…

算法 day4 【双指针、快慢指针、环形链表】链表下

⚡刷题计划day4继续&#xff0c;可以点个免费的赞哦~ 下一期将会开启哈希表刷题专题&#xff0c;往期可看专栏&#xff0c;关注不迷路&#xff0c; 您的支持是我的最大动力&#x1f339;~ 目录 ⚡刷题计划day4继续&#xff0c;可以点个免费的赞哦~ 下一期将会开启哈希表刷题…

C# 匿名函数与Lambda表达式

本文仅作学习笔记与交流&#xff0c;不作任何商业用途&#xff0c;作者能力有限&#xff0c;如有不足还请斧正 1.匿名函数 在 C# 中&#xff0c;匿名函数是一种没有名称的函数&#xff0c;可以直接在代码中定义和使用 匿名函数主要有两种形式&#xff1a;匿名方法和Lambda 表…

Modbus转EtherCAT网关将Modbus协议的数据格式转换为EtherCAT协议

随着工业自动化技术的快速发展&#xff0c;不同通信协议之间的互操作性变得越来越重要。Modbus作为一种广泛使用的串行通信协议&#xff0c;与以太网为基础的EtherCAT协议之间的转换需求日益增长。本文将从网关功能、硬件设计、性能以及应用案例来介绍这款Modbus转EtherCAT网关…

TinaLinux ssh 环境搭建

adb shell passwd root #修改密码 vim /etc/ssh/sshd_config #编辑SSH配置文件/etc/ssh/sshd_config&#xff0c;根据需要配置如端口、允许登录的用户等 切换为英文输入法输入i&#xff0c;将下面PermitRootLogin和PasswordAuthentication改成yes PermitRootLogin yes…

华媒舍:6个媒体宣发套餐,快速突破传播界限

在当今信息爆炸的社会中&#xff0c;有效地传播自己的信息变得愈发困难。特别是对于媒体宣发来说&#xff0c;如何在市场竞争激烈的情况下突破传播界限&#xff0c;让自己的消息传达给更多的人&#xff0c;这是每个企业和个人都面临的难题。 为了解决这个问题&#xff0c;我们推…