当前位置:网站首页>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)主分片保存数据的时候,副分片也要进行数据备份
现在应该知道了分片和节点之间的区别
边栏推荐
- File operation (detailed!)
- Log4j2
- From scratch, develop a web office suite (3): mouse events
- Implementation of address book (file version)
- Small guide for rapid formation of manipulator (VII): description method of position and posture of manipulator
- How to Add P-Values onto Horizontal GGPLOTS
- 电脑无缘无故黑屏,无法调节亮度。
- Seriation in R: How to Optimally Order Objects in a Data Matrice
- Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)
- Cluster Analysis in R Simplified and Enhanced
猜你喜欢

Lekao: contents of the provisions on the responsibility of units for fire safety in the fire protection law

SVO2系列之深度濾波DepthFilter

How to Visualize Missing Data in R using a Heatmap

自然语言处理系列(三)——LSTM

Deep understanding of NN in pytorch Embedding

How to Create a Beautiful Plots in R with Summary Statistics Labels

Dynamic memory (advanced 4)

PyTorch搭建LSTM实现服装分类(FashionMNIST)

PgSQL string is converted to array and associated with other tables, which are displayed in the original order after matching and splicing
![[geek challenge 2019] upload](/img/04/731323142161a4994c14fedae38b81.jpg)
[geek challenge 2019] upload
随机推荐
自然语言处理系列(三)——LSTM
xss-labs-master靶场环境搭建与1-6关解题思路
多文件程序X32dbg动态调试
Dynamic memory (advanced 4)
Cmake cross compilation
Summary of flutter problems
CMake交叉编译
MSI announced that its motherboard products will cancel all paper accessories
The position of the first underline selected by the vant tabs component is abnormal
Three transparent LED displays that were "crowded" in 2022
This article takes you to understand the operation of vim
[visual studio 2019] create MFC desktop program (install MFC development components | create MFC application | edit MFC application window | add click event for button | Modify button text | open appl
求16以内正整数的阶乘,也就是n的阶层(0=<n<=16)。输入1111退出。
还不会安装WSL 2?看这一篇文章就够了
Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)
How does Premiere (PR) import the preset mogrt template?
HOW TO ADD P-VALUES ONTO A GROUPED GGPLOT USING THE GGPUBR R PACKAGE
How to Add P-Values onto Horizontal GGPLOTS
Mish shake the new successor of the deep learning relu activation function
BEAUTIFUL GGPLOT VENN DIAGRAM WITH R