Distributed Lock using Zookeeper
Vložit
- čas přidán 7. 08. 2024
- This is a video about Distributed lock using zookeeper. It covers how with the help of zookeeper data modelling techniques, one can build distributed locks. All you need is to create ephemeral sequential nodes and then add watcher on the nodes. The sequential node with the smallest sequence number will be given the lock. Other nodes will wait for the changes and try to acquire lock ones it gets free.
Here is the github code in java and maven: github.com/anshriva/zookeeper.... This video is part of the playlist: • apache zookeeper
Chapters:
00:00 Introduction
01:10 Problem statement
02:22 solution approach
08:50 Code
12:42 Demo
13:48 Conclusion - Věda a technologie
The best tutorial of Zookeeper I've ever watched, thank you!
thanks 🙏
Well done! You explain the system in plain, simple, and organized terms. I watched the video once and understood very clearly. Thank you!!!!!
Glad it was helpful!
Thanks Anubhav! The whole playlist is amazing! Very helpful.
Amazing Video! Awesome work ❤
Great videos!
Glad you like them!
thank you for the video, would love if you could go into how this would work in a distributed zookeeper cluster.
The cluster flow will be same as this one.
you can get your self started with cluster setup here :
Apache Zookeeper cluster setup on local | Zookeeper multi node ensemble
czcams.com/video/9DXb_nIk99U/video.html and then run the same commands as above.
Thanks for the response, I guess zookeeper internally runs some version of raft
These are great videos! Thank you so much for putting in the effort to make them.
In the video "Distributed Lock using Zookeeper", the code example you walked through can potentially lead to a scenario where the client can end up waiting infinitely for the notification while watching on the znode.
Any idea/pointers on how to avoid getting into this situation?
That's correct. To check the actual production implementation, check out apache curator which is a library to use zookeeper.
Thanks for the videos, but one question, what if there are multiple instances of Zookeeper server running (for High Availability), then how does each individual instance know which sequence number to put while creating a node.
Let me think on this and get back. Meanwhile, for the real implementation, i suggest checking out apache curator czcams.com/video/clr4I6ygqIY/video.html
Do I need to start zookeeper in local ?
You did not mention how to start that but used localhost.
please check my playlist, there is a video on how to run zookeeper on local