I'm new to Zookeeper and I'm still not sure about how Zookeeper works with database. In its documentation, it says "Read requests are serviced from the local replica of each server database." So does it mean every server in a Zookeeper system is also a database? Or there is a separate database and each server in zookeeper copy all data in the database and store in its own database (Crazy idea if it's true?)? Or the database in zookeeper server is built up from the data that every times a client requests to have?
Thank you very much
Asked
Active
Viewed 5,090 times
3

Xitrum
- 7,765
- 26
- 90
- 126
1 Answers
2
Every server in a zookeeper cluster keeps a copy of the entire database. As writes are performed, they are sent to every server in the cluster, and a copy of the write is stored on each server.
The size of the data set zookeeper stores should not be very large, as zookeeper stores the entire data set in memory on the jvm heap. Zookeeper is meant more as a place to store configuration information, and for co-ordination between various nodes, rather than storing large amounts of information.

sbridges
- 24,960
- 4
- 64
- 71
-
i really dont understand, if the database is larger than disk size of zookeeper server, how can it store all data in the database to its local disk? – Xitrum Sep 16 '12 at 17:37
-
3If you want to store more than 1 gig in zookeeper, zookeeper is probably not a good fit for your use case. – sbridges Sep 16 '12 at 19:32
-
so can we control which data zookeeper should copy into in memory or not? – Xitrum Sep 17 '12 at 08:19
-
1No, you can't control what is in memory, everything is in memory – sbridges Sep 17 '12 at 13:03
-
As clarification clients write only to the leader ZooKeeper and not to all the follower ZooKeepers. – Mike Argyriou Sep 26 '15 at 17:45
-
Zookeeper stores the data of the nodes in memory but Zookeeper is not meant to work like a cache (for use cases involving a small amount of data, it is an exception). and is mainly used to handle the mechanics of clustering like heartbeat, synchronization etc. https://stackoverflow.com/questions/37293928/zookeeper-vs-in-memory-data-grid-vs-redis – Anurag Shukla Apr 21 '21 at 16:22