当前位置:网站首页>ES集群中节点与分片的区别
ES集群中节点与分片的区别
2022-07-02 09:42:00 【塞班呢】
一开始我也搞混了,以为分片就是节点
节点:节点就是我们一个个的主机,你也可以理解为一个个的ES
分片:分片就是将原来存放在一个节点上面的数据进行分片,然后存放到不同的节点。
分片分为主分片和副分片,副分片是用来进行数据拷贝的
比如这里创建一个索引库
PUT /test
{
"settings": {
"number_of_shards": 3, // 分片数量
"number_of_replicas": 1 // 副本数量
},
"mappings": {
"properties": {
// mapping映射定义 ...
}
}
}
这就表示这个索引库的数据会被存放到三个分片当中,三个分片会分到哪个节点上默认是有ES控制,同时也可以收主节点控制
es01、es02、es03表示三个节点,实体星号表示这个节点为主节点,右边的序号就是分片的序号,并且表示了分片在节点上的分布
下面看插入一条文档的过程,这样更能清楚明了的明白节点与分片的区别
过程:
1)新增一个id=1的文档
2)主节点对id做hash运算,假如得到的是2,则应该存储到shard-2
3)shard-2的主分片在node3节点,将数据路由到node3
4)node3保存文档
5)node3将数据同步给shard-2的副本replica-2,在node2节点
6)返回结果给coordinating-node节点
7)返回结果给用户
注解:
1)shard就是分片的意思
2)hash算法将文档id与分片数量进行取余得到分片的序号,然后就将文档数据存放到该分片所在主机的data数据节点上面去
3)主分片保存数据的时候,副分片也要进行数据备份
现在应该知道了分片和节点之间的区别
边栏推荐
- The selected cells in Excel form have the selection effect of cross shading
- From scratch, develop a web office suite (3): mouse events
- ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪
- How to Visualize Missing Data in R using a Heatmap
- HOW TO ADD P-VALUES TO GGPLOT FACETS
- The computer screen is black for no reason, and the brightness cannot be adjusted.
- GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
- Cluster Analysis in R Simplified and Enhanced
- 基于Arduino和ESP8266的连接手机热点实验(成功)
- (C语言)3个小代码:1+2+3+···+100=?和判断一个年份是闰年还是平年?和计算圆的周长和面积?
猜你喜欢
Esp32 audio frame esp-adf add key peripheral process code tracking
ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪
FLESH-DECT(MedIA 2021)——一个material decomposition的观点
Cluster Analysis in R Simplified and Enhanced
文件操作(详解!)
xss-labs-master靶场环境搭建与1-6关解题思路
GGPlot Examples Best Reference
自然语言处理系列(二)——使用RNN搭建字符级语言模型
【2022 ACTF-wp】
HOW TO ADD P-VALUES ONTO A GROUPED GGPLOT USING THE GGPUBR R PACKAGE
随机推荐
电脑无缘无故黑屏,无法调节亮度。
【C语言】十进制数转换成二进制数
How to Visualize Missing Data in R using a Heatmap
Fabric.js 3个api设置画布宽高
B high and beautiful code snippet sharing image generation
K-Means Clustering Visualization in R: Step By Step Guide
How to Easily Create Barplots with Error Bars in R
2022年遭“挤爆”的三款透明LED显示屏
H5, add a mask layer to the page, which is similar to clicking the upper right corner to open it in the browser
自然语言处理系列(二)——使用RNN搭建字符级语言模型
[untitled] how to mount a hard disk in armbian
自然语言处理系列(三)——LSTM
to_ Bytes and from_ Bytes simple example
Easyexcel and Lombok annotations and commonly used swagger annotations
【2022 ACTF-wp】
PyTorch搭建LSTM实现服装分类(FashionMNIST)
How to Easily Create Barplots with Error Bars in R
Orb-slam2 data sharing and transmission between different threads
How to Create a Beautiful Plots in R with Summary Statistics Labels
Log4j2