ZooKeeper 写数据原理

zk写数据原理

客户端写入请求发送给leader

​ ① 客户端client向leader发送写请求

​ ② leader写数据同时会发送写请求给所有follower

​ ③ 等待follower写入完成的ack,当完成数达到半数(包含自己)时

​ ④ 发送数据写入完成的ack给客户端client

客户端写入请求发送给某个follower

​ ① 客户端client向follower发送写入数据的请求

​ ② follower将客户端client的写请求转发给leader

​ ③ leader 将写请求发送给所有follower,同时自己写入数据

​ ④ leader收到超过半数的数据写入完成ack时

​ ⑤ leader发送完成ack给收到客户端client请求的follower

​ ⑥ 收到客户端client写请求的follower发送ack给客户端client

Guess you like

Origin blog.csdn.net/rfdjds/article/details/121044394