开发者

asking about apache zookeeper [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 8 years ago.

Improve this question

Hallo i am mohamad a student in masters degree I want to ask a question about Zookeeper.

I read that the write operation in zookeeper to be done first the server connected to the cliend must contact the leader and then the leader makes a vote and when he gets more than the half of servers then he replies to the server which is connected to the cliend inorder to go on with this operartion .

But my question is that for what is the voting procccess? i mean they vote for what? and the second question is that how do they vote do they send messages or how do they notify the leader. and the third question is that why do they need voting, i read that there is a versioned number inorder to check the update data so 开发者_StackOverflow社区why do they need voting ???

Please can anybody reply for me as fast as he can .

Thanks in advance


This is the fastest I can. You need to get the book Distributed Algorithms by Nancy Lynch for better understanding of how these systems works.

Background - The algorithm paradigm is called Paxos though Zookeeper has its own implementation which is a bit different. Zookeeper commits data in a two phased commit. All the communication happens using Atomic Broadcast Protocol over a FIFO channel to preserve ordering.

What is the voting processes - Voting process is for finding a leader not for two phased commit. No ballots nothing. Node with highest zxid is the leader.

Voting is for leader election. Two phased commit is for write operations. For more info check out the zookeeper docs and more importantly dist algos book to understand why these things behave the way they are :).

--Sai


ZooKeeper follows a simple client-server model where clients are nodes (i.e., machines) that make use of the service, and servers are nodes that provide the service. A collection of ZooKeeper servers forms a ZooKeeper ensemble. At any given time, one ZooKeeper client is connected to one ZooKeeper server. Each ZooKeeper server can handle a large number of client connections at the same time. Each client periodically sends pings to the ZooKeeper server it is connected to let it know that it is alive and connected. The ZooKeeper server in question responds with an acknowledgment of the ping, indicating the server is alive as well. When the client doesn't receive an acknowledgment from the server within the specified time, the client connects to another server in the ensemble, and the client session is transparently transferred over to the new ZooKeeper server. Check this to understand the zookeeper architecture

When a client requests to read the contents of a particular znode, the read takes place at the server that the client is connected to. Consequently, since only one server from the ensemble is involved, reads are quick and scalable. However, for writes to be completed successfully, a strict majority of the nodes of the ZooKeeper ensemble are required to be available. When the ZooKeeper service is brought up, one node from the ensemble is elected as the leader. When a client issues a write request, the connected server passes on the request to the leader. This leader then issues the same write request to all the nodes of the ensemble. If a strict majority of the nodes (also known as a quorum) respond successfully to this write request, the write request is considered to have succeeded. A successful return code is then returned to the client who initiated the write request. If a quorum of nodes are not available in an ensemble, the ZooKeeper service is nonfunctional. Check this to understand the voting process for write operations

For the service to be reliable and scalable, it is replicated over a set of machines. ZooKeeper uses a version of the famous Paxos algorithm, to keep replicas consistent.

Zookeeper gives the following consistency guarantees

Sequential Consistency Updates from a client will be applied in the order that they were sent.

Atomicity Updates either succeed or fail -- there are no partial results.

Single System Image A client will see the same view of the service regardless of the server that it connects to.

Reliability Once an update has been applied, it will persist from that time forward until a client overwrites the update. This guarantee has two corollaries:

Timeliness The clients view of the system is guaranteed to be up-to-date within a certain time bound (on the order of tens of seconds). Either system changes will be seen by a client within this bound, or the client will detect a service outage.

Here are the answers to your questions

Question1: The voting is for whether the write operation should be committed or not.

Question2: The communication between clients and servers in the zookeeper ensemble happen over a TCP connection through the exchange of messages using ZAB protocol

Question3: For the service to be reliable and fault tolerant, the data has to be replicated to a quorum of servers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜