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

news2024/9/21 20:55:17

前言

本文主要讲了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 elastic

docker 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.3
  
docker 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.3
  
  
docker 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.coloradmin.cn/o/1947143.html

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

相关文章

SSRF中伪协议学习

SSRF常用的伪协议 file:// 从文件系统中获取文件内容,如file:///etc/passwd dict:// 字典服务协议,访问字典资源,如 dict:///ip:6739/info: ftp:// 可用于网络端口扫描 sftp:// SSH文件传输协议或安全文件传输协议 ldap://轻量级目录访问协议 tftp:// 简单文件传输协议 gopher…

算法——滑动窗口(day8)

30.串联所有单词的子串 30. 串联所有单词的子串 - 力扣(LeetCode) 必看!!!本题是我们上次写的438.异位词的进阶版,可参考本篇文章:算法——滑动窗口(day7)-CSDN博客来…

c++笔记2

目录 2.2 栈底(bottom) } 大数乘大数 节点:包含一个数据元素及若干指向子树分支的信息 。 节点的度:一个节点拥有子树的数目称为节点的度 。 叶子节点:也称为终端节点,没有子树的节点或者度为零的节点…

vue3+openLayers触摸事件显示弹窗

<template><!--地图--><div class"distributeMap" id"distributeMap"></div><!--弹窗--><section ref"popup" id"popupDiv" class"popup">{{ state.popupParams.name }}</section&g…

OpenGauss和GaussDB有何不同

OpenGauss和GaussDB是两个不同的数据库产品&#xff0c;它们都具有高性能、高可靠性和高可扩展性等优点&#xff0c;但是它们之间也有一些区别和相似之处。了解它们之间的关系、区别、建议、适用场景和如何学习&#xff0c;对于提高技能和保持行业敏感性非常重要。本文将深入探…

电脑ip地址怎么改?修改技巧大放送!

在现代网络环境中&#xff0c;IP地址的设置对于连接互联网和局域网至关重要。无论是因为网络配置的需求&#xff0c;还是出于隐私和安全考虑&#xff0c;学会更改电脑的IP地址是一项有用的技能。本文将介绍电脑ip地址怎么改的3种方法&#xff0c;帮助您根据不同需求灵活调整网络…

Go并发GMP调度模型

如何知道一个对象是分配在栈上还是堆上&#xff1f; Go和C不同&#xff0c;Go的逃逸分析是在编译器完成的&#xff1b;go局部变量会进行逃逸分析。如果变量离开作用域后没有被引用&#xff0c;则优先分配到栈上&#xff0c;否则分配到堆上。那么如何判断是否发生了逃逸呢&#…

VMWare 16 安装

1、下载地址 VMware-workstation-full-16.2.4-20089737 2、激活码 VM16&#xff1a;ZF3R0-FHED2-M80TY-8QYGC-NPKYF 3、安装步骤 修改一下【安装位置】&#xff0c;将【增强型键盘驱动程序(需要重新引导以使用此功能()此功能要求主机驱动器上具有 10MB 空间。】【将 wMware…

【LLM】-07-提示工程-聊天机器人

目录 1、给定身份 1.1、基础代码 1.2、聊天机器人 2、构建上下文 3、订餐机器人 3.1、窗口可视化 3.2、构建机器人 3.3、创建JSON摘要 利用会话形式&#xff0c;与具有个性化特性&#xff08;或专门为特定任务或行为设计&#xff09;的聊天机器人进行深度对话。 在 Ch…

钉钉 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…

同花顺股票数据逆向:Cookie加密和Hook注入

&#x1f50d; 思路与步骤详解 &#x1f310; 抓包解析接口 首先&#xff0c;我们使用抓包工具对同花顺的股票数据接口进行分析&#xff0c;发现其中的Cookie参数经过了加密处理。 接下来&#xff0c;我们需要深入挖掘这些加密参数的生成位置。 &#x1f6e0; hook注入 对于…

信号的运算

信号实现运算&#xff0c;首先要明确&#xff0c;电路此时为负反馈电路&#xff0c;当处于深度负反馈时&#xff0c;可直接使用虚短虚断。负反馈相关内容可见&#xff1a;放大电路中的反馈_基极反馈-CSDN博客https://blog.csdn.net/qq_63796876/article/details/140438759 一、…

【深度学习总结】基于U-Mamba使用nnUNetv2处理BraTS挑战赛数据

基于U-Mamba使用nnUNetv2处理BraTS挑战赛数据 【深度学习总结】基于U-Mamba使用nnUNetv2处理BraTS挑战赛数据U-Mamba介绍数据集下载环境准备数据集准备运行其他2D网络结构UMambaBot的模型结构UMambaEnc的模型结构 【深度学习总结】基于U-Mamba使用nnUNetv2处理BraTS挑战赛数据 …

matlab仿真 数字基带传输(下)

&#xff08;内容源自详解MATLAB&#xff0f;SIMULINK 通信系统建模与仿真 刘学勇编著第六章内容&#xff0c;有兴趣的读者请阅读原书&#xff09; clear all Fd1;%符号采样频率 Fs10;%滤波器采样频率 r0.2;%滤波器滚降系数 delay4;%滤波器时延 [num,den]rcosine(Fd,Fs,defau…

使用LLaMA-Factory对Llama3-8B-Chinese-Chat进行微调

文章目录 模型及数据&#xff1a;模型下载数据 LLaMA-Factory启动拉取代码启动webui 模型训练数据导入数据预览设置模型路径配置参数及参数的保存开始训练 过程观察加载模型、对话模型导出、再次加载 模型及数据&#xff1a; 模型下载 使用基于中文数据训练过的 LLaMA3 8B 模…

Java基本数据类型与String类型的转换

目录 基本数据类型和Strng类型的转换 第一种方法 第二种方法 将字符串转成字符 注意事项 本章练习题 题1 题2 基本数据类型和Strng类型的转换 第一种方法 使用号和" "即可完成转换 第二种方法 第二种方法是通过基本类型的包装类调用parsexx方法 将字符…

计算机视觉与图像分类:技术原理、应用与发展前景

引言 随着科技的不断进步&#xff0c;计算机视觉逐渐成为了人工智能领域的重要分支之一。计算机视觉旨在让计算机具备“看懂”图像和视频的能力&#xff0c;从而理解和分析视觉信息。作为计算机视觉中的一个关键任务&#xff0c;图像分类涉及将输入的图像归类到预定义的类别中&…

Ubuntu20.04安装Elasticsearch

简介 ELK&#xff08;Elasticsearch, Logstash, Kibana&#xff09;是一套开源的日志管理和分析工具&#xff0c;用于收集、存储、分析和可视化日志数据。以下是如何在Ubuntu服务器上安装和配置ELK堆栈以便发送和分析日志信息的步骤。 安装Elasticsearch 首先&#xff0c;安…

使用 vSphere vCenter 管理 ESXi

使用 vSphere vCenter 管理 ESXi 1、新建数据中心 在 vSphere Client 中&#xff0c;左上角图标&#xff0c;进入 “清单”&#xff0c;鼠标右键名称&#xff0c;新建数据中心。 输入数据中心名称&#xff0c;我这里直接使用默认值&#xff0c;点击确定。 2、往数据中心中添加…

html+css 边框滑动按钮效果

前言&#xff1a;哈喽&#xff0c;大家好&#xff0c;今天给大家分享htmlcss 绚丽效果&#xff01;并提供具体代码帮助大家深入理解&#xff0c;彻底掌握&#xff01;创作不易&#xff0c;如果能帮助到大家或者给大家一些灵感和启发&#xff0c;欢迎收藏关注哦 &#x1f495; 文…