您的位置:天气预报查询一周

elasticsearch是怎么读写的

更新时间: 2024-05-20 15:18:57

1、es 写数据过程:客户端选择一个 node 发送请求过去,这个 node 就是 coordinating node(协调节点)。coordinating node 对 document 进行路由,将请求转发给对应的 node(有 primary shard)。

实际的 node 上的 primary shard 处理请求,然后将数据同步到 replica nodcoordinating node 如果发现 primary node 和所有 replica node 都搞定之后,就返回响应结果给客户端。

2、es 读数据过程:可以通过 doc id 来查询,会根据 doc id 进行 hash,判断出来当时把 doc id分配到了哪个 shard 上面去,从那个 shard 去查询。客户端发送请求到任意一个 node,成为 coordinate node。

coordinate node 对 doc id 进行哈希路由,将请求转发到对应的 node,此时会使用 round-robin随机轮询算法,在 primary shard 以及其所有 replica 中随机选择一个,让读请求负载均衡。接收请求的 node 返回 document 给 coordinate node。coordinate node 返回 document 给客户端。

标签: elasticsearch 怎么

天气预报查询一周-www.15tqw.com 版权所有 违法和不良信息举报中心
本站天气仅提供参考,如果您对本站有任何建议或意见,或有任务合作意向可联系我们
电话:邮箱:
闽ICP备18026954号-24