让Elasticsearch集群冷热分离、读写分离

如何设计ES的冷热数据分离架构?Elasticsearch 集群如何实现高可用?如何避免脑裂问题?如果出现脑裂如何恢复? 本文介绍了Elasticsearch的冷热架构设计与高可用方案。冷热架构通过SSD节点组存储近7天热数据,HDD节点组存储历史数据,配合ILM策略实现自动迁移。高可用方案采用多节点组设计,包含主节点组、数据节点组和协调节点组,通过副本策略、分片重平衡和客户端重试机制保障容灾能力。关键配置包括分片分配策略、故障检测和自动恢复机制,确保系统在节点故障时仍能稳定运行。该方案兼顾性能与成本,适用于大规模数据存储场景。 阅读详情

根据Elasticsearch中文社区《ES冷热分离(读写分离) hot, stale 场景》一篇整理的。

一、冷热分离

二、读写分离

  • 即使这样处理后,hot集群即使只有一两数据,但是一般象log类数据,查询的一般都是最近一两天的数据,致使hot集群负载依然很大。es有没有办法实现像mysql主从的效果,然后查询只在从机上查询?有没有办法让副本分布在某些特定节点上,然后查询只查询这些节点?
  • 按《elasticsearch高级配置之分片分布规则设置》中(强制分布规则)来设置,迫使不允许副本被分配到与主分片相同的区域,比如:让副本数据分布到stale集群上。
  • 上面的规则有时并不能完全的控制复本一定在某个集群上,它只能尽量保证主分片和副本不在一个集群上,这个时候同样也可以起个定时任务,手动的将副本reroute到集群节点上

    POST /_cluster/reroute
    {
        "commands" : [ {
            "move" :
                {
                  "index" : "test", "shard" : 0,
                  "from_node" : "node1", "to_node" : "node2"
                }
            },
            {
              "allocate" : {
                  "index" : "test", "shard" : 1, "node" : "node3"
              }
            }
        ]
    }
  • 详细情况参考:
    https://www.elastic.co/guide/en/elasticsearch/reference/2.1/modules-cluster.html
    https://www.elastic.co/guide/en/elasticsearch/reference/2.1/cluster-reroute.html

三、查询选项

四、总结

  1. 已经不再indexing的索引,通过require.zone的方式迁移到stale集群上,完成冷热分离;
  2. 还在indexing的索引,通过reroute将replica shard强制allocate到stale集群上;
  3. search的时候,通过?preference=_replica或者?preference=_only_nodes:xxx的方式指定读取哪些。
  4. 但是需要注意一点的是:因为es的replica也是一个实际需要cpu和io的indexing过程,而且indexing本身也有要求要写够一定副本数来才算写入完成。所以,你即使只请求replica,也是有可能影响到写入的。

    所以,你只能开启一个副本——写入副本数要求是从二个副本开始才有。

数据冷热分离,Hbase,Elasticsearch,redis,分库分表,缓存,kafka 阅读详情

相关推荐

elasticsearch 运维记录

目录 (elasticsearch 基础知识汇总) 索引分片 从策略层面控制分片分配的选择 move 指令 节点下线 冷热数据的读写分离 集群自动发现 API 接口 数据写入 数据读取 数据删除 数据更新 搜索请求 集群健康状态 level 请求参数 节点状态监控接口 GC垃圾回收索引分片: 从策略层面,控制分片分配的选择 磁盘限额 为了保护节点数据安全,ES 会定时(cluster.info.up

zxf_668899的博客 7659

ElasticSearch7.x集群搭建(es7)主从读写分离搭建教程

适用人群 开发从业人员,大数据从业人员,运维从业人员,IT相关从业人员,想快速掌握技能的一切人员课程概述 ElasticSearch7.x集群?Elasticsearch-head7.x官网都没有的插件整合?cerebro插件酷炫暗黑插件神器?一次搞定官网版本 主从读写 中文分词 Head插件 cerebro插件

基于OpenCV C++实现工业级形状模板匹配:仿Halcon SBM算法全解析

在计算机视觉和工业自动化领域,模板匹配是一项基础且关键的技术,用于在图像中定位已知目标。其核心原理是通过计算图像区域与预设模板之间的相似度来识别目标位置。传统的基于灰度值的匹配方法对光照变化敏感,鲁棒性不足。而基于边缘梯度方向的形状匹配技术,通过计算轮廓梯度方向的一致性进行相似度度量,从根本上提升了对光照变化的鲁棒性,并支持目标的旋转与缩放,技术价值显著。这项技术广泛应用于工业视觉检测、机器人引导、PCB定位等对精度和稳定性要求极高的场景。本文聚焦于使用开源OpenCV库,从底层仿照Halcon的Shape

weixin_33691817的博客 500

ES集群读写分离

根据Elasticsearch中文社区《ES冷热分离(读写分离) hot, stale 场景》一篇整理并测试修改后实现 本项目按照该原理实现读写分离写的数据如果需要实时被读取,实际上不可能实现完全的读写分离的。 分区读写分离方法:假设 集群有8个节点,node1,node2,node3,node4 为热区,设置为hot,node5,node6,node7,node8 为冷区,设置为stable.

joez的专栏 5283

开源滑翔伞升降速度表:基于STM32与传感器融合的DIY飞行仪表

传感器融合是现代嵌入式系统与物联网设备中的核心技术,它通过整合多个传感器的数据,利用滤波与估计算法,获得比单一传感器更精确、更可靠的环境感知能力。其技术价值在于提升系统的鲁棒性、精度和上下文理解能力,广泛应用于无人机导航、可穿戴设备、工业监测及智能驾驶等领域。本文聚焦于一个具体的工程实践案例——开源多功能滑翔伞升降速度表(Open-Vario),该项目巧妙地运用了**卡尔曼滤波器**进行气压与GNSS数据的融合,以精确计算升降率,并基于**FreeRTOS**实时操作系统构建了一个稳定、可扩展的嵌入式平台,

weixin_33657398的博客 176

CAPL编程的催化剂——CAPLdll的实现

CANoe作为一款功能强大的总线开发及测试工具,不仅仅是因为其丰富的库函数,最重要的是其兼容了多种编程语言,可以实现灵活的开发,极大的解决了纯CAPL编程所带来的限制,如通过动态链接库(DLL)来实现复杂函数的编写,使其能够在CAPL中可以调用,下面将对DLL的实现进行分析。capldll.cpp这个文件初看相当复杂,从整体上来说,这段代码主要包含了两部分:自定义函数实现和回调函数定义,今天的主要任务是实现自定义函数,这里的函数定义与普通函数定义差不多,只是利用了CAPL的格式。在VS2017工程中打开。

车载控制器AutoSAR软件开发工程师 4646

【elasticsearch】elasticsearch es读写原理

今天来学习下 es 的写入原理。

Mrerlou的博客 3999

软件设计师---计算机系统

软件设计师---计算机系统

我从不打没有准备的仗! 3万+

让Elasticsearch集群冷热分离、读写分离【转】

转自:https://blog.youkuaiyun.com/jiao_fuyou/article/details/50511255 根据Elasticsearch中文社区《ES冷热分离(读写分离) hot, stale 场景》一篇整理的。 一、冷热分离 按《控制Elasticsearch分片和副本的分配》来设置,将hot,stale数据分到不同的集群上去 hot集群只保留最近一天或两天...

dianzhouyu2189的博客 447

Python爬虫实战:基于最新技术栈的政府招标采购数据抓取与分析

对于企业、研究人员和数据分析师来说,能够高效地获取这些数据意味着可以获得宝贵的商业洞察和市场先机。随着反爬技术的不断升级和网站结构的日益复杂,传统的爬虫方法已经难以满足需求。我们将采用Selenium、Playwright等现代浏览器自动化工具,结合Scrapy框架和异步请求库,构建一个能够应对各种反爬措施的强大爬虫系统。Playwright是微软开发的浏览器自动化工具,支持Chromium、WebKit和Firefox,比Selenium更快速、更稳定。

2201_76125261的博客 1311

使用Matlab simulink的PLC coder功能进行算法搭建与处理

使用的案例如下: Anti-Windup PID Control Demonstration with Feedforward Control 将其中的PID块生成SCL语言再导入TIA 使用的平台如下: Matlab 2019b TIA portal 15.1 应用:可以在PLC中搭载一些并不方便使用的,或者比较难使用的算法 步骤如下: 首先打开案例,案例地址我放在最下面,点击Run运行仿真,必...

苦走一口田 1万+

让Elasticsearch集群冷热分享、读写分离

根据Elasticsearch中文社区《ES冷热分离(读写分离) hot, stale 场景》一篇整理的。 一、冷热分离 按《控制Elasticsearch分片和副本的分配》来设置,将hot,stale数据分到不同的集群上去hot集群只保留最近一天或两天数据 写一个定时任务每天凌晨将前一天的索引标记为stale PUT /index_name/_settings { "i

mllhxn的专栏 2847

MinerU在线API异步调用代码开发示例

本文展示了如何使用Python异步编程调用MinerU在线API进行文件批量上传。代码示例包含三个主要功能:1) 通过API密钥获取文件上传URL;2) 使用信号量控制并发上传多个文件;3) 获取提取结果。实现采用httpx异步客户端和asyncio库,支持文件存在性检查、错误处理和日志记录。示例中演示了如何上传PDF文件到MinerU平台,并提供了获取批量处理结果的接口。该代码可作为异步调用MinerU API的参考实现。

拥抱具身智能,昇腾Ascend C 351

企业级分布式搜索引擎

基于星环科技大数据基础平台TDH的多模型统⼀技术,实现关系型数据、图数据、时序数据、向量数据等11种模型数据统一存储管理,用户只需一句SQL就可以将多种模型数据直接关联分析,大幅降低了开发的复杂度,避免了复杂的数据流转,提升了分析效率。此外,Transwarp Scope已完成与主流信创生态厂商的适配互认工作,支持适配长城飞腾、华为泰山、龙芯等服务器架构,以及麒麟,UOS等操作系统,在传统搜索业务的功能外,同时提供多租户、联邦检索等多样化功能,充分满足国产化替换需求。

shaoqigulang的博客 367

在Qt中集成VTK和PCL:实现数据可视化的完整指南

在现代软件开发中,数据可视化至关重要。将VTK(Visualization Toolkit)和PCL(Point Cloud Library)集成到Qt环境里,能为开发者提供强大的可视化解决方案。本文将深入讲解如何在Qt中读取PCL文件,展示VTK模型和PCL数据,适合想要在Qt项目中实现数据可视化的开发者。

轩宇的博客 916

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

三、elasticsearch架构原理

引言 从数据流向和分布的层面,介绍es的工作原理和架构设计,然后针对性的做性能优化、故障处理等。这次主要介绍es的准实时索引的实现、segment的影响、routing和replica的的读写过程,shard的allocate控制以及自动发现的配置做一些介绍。 而关于更底层的lucene的原理,在以后会做一些简单介绍。 1、准实时索引的实现   把es的每个分片(shard)当做一个lucene,...

weixin_43053022的博客 1446

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

Elasticsearch5.5冷热数据读写分离

本文转载于:https://elasticsearch.cn/article/6127,请支持原文作者 Elasticsearch5.5冷热数据读写分离 前言 冷数据索引:查询频率低,基本无写入,一般为当天或最近2天以前的数据索引 热数据索引:查询频率高,写入压力大,一般为当天数据索引 当前系统日志每日写入量约为6T左右,日志数据供全线业务系统查询使用。 查询问题: 高峰时段写入及查询频率都较...

划水的银开的博客 1740

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

企业级分布式搜索引擎Transwarp Scope助力企业打造自主可控高性能搜索平台

基于星环科技大数据基础平台TDH的多模型统⼀技术,实现关系型数据、图数据、时序数据、向量数据等11种模型数据统一存储管理,用户只需一句SQL就可以将多种模型数据直接关联分析,大幅降低了开发的复杂度,避免了复杂的数据流转,提升了分析效率。此外,Transwarp Scope已完成与主流信创生态厂商的适配互认工作,支持适配长城飞腾、华为泰山、龙芯等服务器架构,以及麒麟,UOS等操作系统,在传统搜索业务的功能外,同时提供多租户、联邦检索等多样化功能,充分满足国产化替换需求。

shaoqigulang的博客 397

mysql 冷热数据分离_elasticsearch冷热数据读写分离

Elasticsearch5.5冷热数据读写分离前言冷数据索引:查询频率低,基本无写入,一般为当天或最近2天以前的数据索引热数据索引:查询频率高,写入压力大,一般为当天数据索引当前系统日志每日写入量约为6T左右,日志数据供全线业务系统查询使用。查询问题:高峰时段写入及查询频率都较高,集群压力较大,查询ES时,常出现查询缓慢问题。写入问题:索引峰值写入量约为12w/s,且无副本。加上副本将导致索引写...

weixin_39964528的博客 821

ES02# Elasticsearch术语与部署架构梳理

引言ES体系化梳理第二篇,从基本概念和术语开始,走查了集群中的节点以及其在ES集群中可扮演的角色,最后走查了常见的集群部署架构。本文主要内容有:基本概念与术语节点角色与集群状态常用集群部署架构一、基本概念与术语Document: 是es搜索的最小单位,被序列化成json对象存入es。文档类比关系数据库一条记录每个文档有一个唯一的ID,类比关系数据库主键IDjson对象由f...

gaoliang1719的专栏 2149

ElasticStack系列之二十 & 数据均衡、迁移、冷热分离以及节点自动发现原理与机制...

1. 数据均衡   某个shard分配到哪个节点上,一般来说,是由 ELasticSearch 自行决定的。以下几种情况会触发分配动作: 新索引的建立 索引的删除 新增副本分片 节点增减引发的数据均衡   在动态分配的时候有几个默认值需要注意,当然对应的这些默认值都是可以修改的,具体如下: ElasticSearch 默认要求所有分片都正常启动成功以后,才可以进行数据均衡...

weixin_30765475的博客 335

让Elasticsearch飞起来!百亿级实时查询优化实战

最近的一个项目是风控过程数据实时统计分析和聚合的一个 OLAP 分析监控平台,日流量峰值在 10 到 12 亿上下,每年数据约 4000 亿条,占用空间大概 200T。 面对这样一个数据量级的需求,我们的数据如何存储和实现实时查询将是一个严峻的挑战。 经过对 Elasticsearch 多方调研和超过几百亿条数据的插入和聚合查询的验证之后,我们总结出以下几种能够有效提升性能和解决这一问题的方案...

东境物语 915
上一篇: elasticsearch高级配置之分片分布规则设置
下一篇: 关于fielddata数据占用内存过大的解决方法
笑天居士
博客等级 码龄24年 292粉丝 136原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值