当前位置:网站首页>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)主分片保存数据的时候,副分片也要进行数据备份
现在应该知道了分片和节点之间的区别
边栏推荐
- HOW TO EASILY CREATE BARPLOTS WITH ERROR BARS IN R
- Dynamic memory (advanced 4)
- Pytorch builds LSTM to realize clothing classification (fashionmnist)
- to_ Bytes and from_ Bytes simple example
- ESP32 Arduino 引入LVGL 碰到的一些问题
- Analyse de l'industrie
- 预言机链上链下调研
- 数据分析 - matplotlib示例代码
- The computer screen is black for no reason, and the brightness cannot be adjusted.
- CMake交叉编译
猜你喜欢

HR wonderful dividing line

ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪

Natural language processing series (II) -- building character level language model using RNN

xss-labs-master靶场环境搭建与1-6关解题思路

HOW TO ADD P-VALUES ONTO A GROUPED GGPLOT USING THE GGPUBR R PACKAGE

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

Read the Flink source code and join Alibaba cloud Flink group..

HOW TO ADD P-VALUES TO GGPLOT FACETS

PyTorch nn.RNN 参数全解析

PgSQL string is converted to array and associated with other tables, which are displayed in the original order after matching and splicing
随机推荐
Implementation of address book (file version)
行業的分析
求16以内正整数的阶乘,也就是n的阶层(0=<n<=16)。输入1111退出。
HOW TO CREATE A BEAUTIFUL INTERACTIVE HEATMAP IN R
MySql存储过程游标遍历结果集
How to Visualize Missing Data in R using a Heatmap
Filtre de profondeur de la série svo2
Data analysis - Matplotlib sample code
H5,为页面添加遮罩层,实现类似于点击右上角在浏览器中打开
Analyse de l'industrie
How to Visualize Missing Data in R using a Heatmap
2022年遭“挤爆”的三款透明LED显示屏
[untitled] how to mount a hard disk in armbian
Easyexcel and Lombok annotations and commonly used swagger annotations
Small guide for rapid formation of manipulator (VII): description method of position and posture of manipulator
How does Premiere (PR) import the preset mogrt template?
MSI announced that its motherboard products will cancel all paper accessories
PyTorch中repeat、tile与repeat_interleave的区别
CMake交叉编译
Orb-slam2 data sharing and transmission between different threads