

{"id":15347,"date":"2018-05-30T06:24:06","date_gmt":"2018-05-30T06:24:06","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=15347"},"modified":"2018-05-30T06:24:06","modified_gmt":"2018-05-30T06:24:06","slug":"zookeeper-in-kafka","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/","title":{"rendered":"Role of Apache ZooKeeper in Kafka &#8211; Monitoring &amp; Configuration"},"content":{"rendered":"<p><span style=\"font-weight: 400\">Today, we will see the Role of Zookeeper in Kafka. This article contains why ZooKeeper is required in Kafka. We can say, ZooKeeper is an inseparable part of <strong>Apache Kafka<\/strong>. Before knowing the role of ZooKeeper in Apache Kafka, we will also see what is Apache ZooKeeper. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Also, we will cover the introduction to ZooKeeper Production Deployment in detail. Moreover, we are going to discuss how Apache Kafka talks to\u00a0ZooKeeper.<\/span><\/p>\n<p><span style=\"font-weight: 400\"> In addition, this Kafka ZooKeeper tutorial introduces us with the hardware and configurations for ZooKeeper. Along with this, we are going to study ZooKeeper stable versions and Monitoring in ZooKeeper.<\/span><\/p>\n<p>So, let&#8217;s discuss role of ZooKeeper in Kafka.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-73646 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg\" alt=\"role of zookeeper in kafka\" width=\"802\" height=\"420\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg 802w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka-520x272.jpg 520w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<h2><span style=\"font-weight: 400\">What is ZooKeeper?<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Apache ZooKeeper plays the very important role in system architecture as it works in the shadow of more exposed <strong>Big Data<\/strong> tools, as <strong>Apache Spark<\/strong> or Apache Kafka.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">In other words, Apache Zookeeper is a distributed, open-source configuration, synchronization service along with naming registry for distributed applications.\u00a0<\/span><\/p>\n<div id=\"attachment_15749\" style=\"width: 522px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/2018-05-11.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-15749\" class=\"wp-image-15749 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/2018-05-11.png\" alt=\"What is ZooKeeper\" width=\"512\" height=\"217\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/2018-05-11.png 512w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/2018-05-11-150x64.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/2018-05-11-300x127.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><p id=\"caption-attachment-15749\" class=\"wp-caption-text\">What is ZooKeeper<\/p><\/div>\n<p>Originally, the ZooKeeper framework was built at \u201cYahoo!\u201d. Because it helps to access their applications in an easy manner. Further, for organized service used by<strong> Hadoop<\/strong>, <strong>HBase<\/strong>, it became a standard and other distributed frameworks.<\/p>\n<p>Now, let&#8217;s discuss the role of\u00a0ZooKeeper in Kafka in detail:<\/p>\n<h2><span style=\"font-weight: 400\">ZooKeeper in Kafka\u00a0 <\/span><\/h2>\n<p><span style=\"font-weight: 400\">Basically, Kafka &#8211; ZooKeeper stores a lot of shared information about <strong>Kafka Consumers<\/strong> and Kafka <strong>Brokers<\/strong>, let&#8217;s discuss them in detail:<\/span><\/p>\n<div id=\"attachment_15635\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Role-of-ZooKeeper-in-Kafka-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-15635\" class=\"wp-image-15635 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Role-of-ZooKeeper-in-Kafka-01.jpg\" alt=\"Requirement of ZooKeeper in Kafka\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Role-of-ZooKeeper-in-Kafka-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Role-of-ZooKeeper-in-Kafka-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Role-of-ZooKeeper-in-Kafka-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Role-of-ZooKeeper-in-Kafka-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Role-of-ZooKeeper-in-Kafka-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-15635\" class=\"wp-caption-text\">The requirement of ZooKeeper in Kafka<\/p><\/div>\n<h3><span style=\"font-weight: 400\">a. Kafka Brokers<\/span><\/h3>\n<p>Below given are the roles of ZooKeeper in\u00a0<strong>Kafka Broker<\/strong>:<\/p>\n<p><strong>i. State<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Zookeeper determines the state. That means, it notices, if the Kafka Broker is alive, always when it regularly sends heartbeats requests. Also, while the Broker is the constraint to handle replication, it must be able to follow replication needs.<\/span><\/p>\n<p><strong>ii. Quotas<\/strong><\/p>\n<p><span style=\"font-weight: 400\">In order to have different producing and consuming quotas, Kafka Broker allows some clients. This value is set in ZK under \/config\/clients path. Also, we can change it in bin\/kafka-configs.sh script.<\/span><\/p>\n<p><strong>iii. Replicas<\/strong><\/p>\n<p><span style=\"font-weight: 400\">However, for each topic, Zookeeper in Kafka keeps a set of in-sync replicas (ISR). Moreover, if somehow previously selected leader node fails then on the basis of currently live nodes Apache ZooKeeper will elect the new leader.<\/span><\/p>\n<p><strong>iv. Nodes and Topics Registry<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Basically, Zookeeper in Kafka stores nodes and topic registries. It is possible to find there all available brokers in Kafka and, more precisely, which Kafka topics are held by each broker, under \/brokers\/ids and \/brokers\/topics zNodes, they&#8217;re stored. In addition, when it&#8217;s started, Kafka broker create the register automatically.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">b. Kafka Consumers<\/span><\/h3>\n<p><strong>i. Offsets <\/strong><\/p>\n<p><span style=\"font-weight: 400\">ZooKeeper is the default storage engine, for consumer offsets, in Kafka&#8217;s 0.9.1 release. However, all information about how many messages Kafka consumer consumes by each consumer is stored in ZooKeeper.<\/span><\/p>\n<p><strong>ii. Registry<\/strong><\/p>\n<p><span style=\"font-weight: 400\"><strong>Consumers in Kafka<\/strong> also have their own registry as in the case of Kafka Brokers. However, same rules apply to it, ie. as ephemeral zNode, it&#8217;s destroyed once consumer goes down and the registration process is made automatically by the consumer.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">How does Kafka talk to ZooKeeper?<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Here, we will see how Kafka classes are responsible for working with ZooKeeper. <\/span><span style=\"font-weight: 400\"><strong>Scala class <\/strong>representing Kafka is KafkaServer. Its startup() method, initZk() contains a call to method initializing ZooKeeper connection. <\/span><\/p>\n<p><span style=\"font-weight: 400\">There are several methods in this algorithm which we use in this Zookeeper method. Hence, as a result, the method creates the temporary connection to ZooKeeper, in this case. <\/span><\/p>\n<p><span style=\"font-weight: 400\">This session is responsible for creating zNodes corresponding to chroot if it&#8217;s miAfterwarderwards, this connection closes and creates the final connection held by the server.<\/span><\/p>\n<p><span style=\"font-weight: 400\">After, still inside initZk(), Kafka initializes all persistent zNodes, especially which server uses. We can retrieve there, among others: \/consumers, \/brokers\/ids, \/brokers\/topics, \/config, \/admin\/delete_topics, \/brokers\/seqid, \/isr_change_notification, \/config\/topics, \/config\/clients.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Now, using synchronization to initialize other members, we can use this created ZooKeeper instance:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\">Replica manager<\/span><\/li>\n<li><span style=\"font-weight: 400\">Config manager<\/span><\/li>\n<li><span style=\"font-weight: 400\">Coordinator, and controller<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400\">ZooKeeper Production Deployment<\/span><\/h2>\n<p><span style=\"font-weight: 400\">In order to store persistent cluster metadata,\u00a0Kafka uses ZooKeeper. Suppose, we lost the Kafka data in |zk|, the mapping of replicas to Kafka Brokers and topic configurations would be lost as well, making our Kafka Cluster no longer functional and potentially resulting in total data loss.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Stable Version of ZooKeeper\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400\">However, the current stable branch is 3.4 and the latest release of that branch is 3.4.9.<\/span><br \/>\n<span style=\"font-weight: 400\">Also, we can use \u201cfour letter word\u201d ENVI, to find the current version of a running server.<\/span><br \/>\n<span style=\"font-weight: 400\"> For example:<\/span><br \/>\n<span style=\"font-weight: 400\">echo envi | nc localhost 2181<\/span><br \/>\n<span style=\"font-weight: 400\">It shows all of the environment information for the ZooKeeper server, including the version.<\/span><br \/>\n<span style=\"font-weight: 400\">Note: Only with this version of ZooKeeper, the ZooKeeper start script and tests the functionality of ZooKeeper.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Hardware of ZooKeeper Server<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Here are some guidelines, for choosing proper hardware for a cluster of ZooKeeper servers.\u00a0<\/span><\/p>\n<div id=\"attachment_16007\" style=\"width: 510px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/ZooKeeper-Server-Hardware-01.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-16007\" class=\"wp-image-16007 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/ZooKeeper-Server-Hardware-01.png\" alt=\"ZooKeeper in Kafka\" width=\"500\" height=\"500\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/ZooKeeper-Server-Hardware-01.png 500w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/ZooKeeper-Server-Hardware-01-150x150.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/ZooKeeper-Server-Hardware-01-300x300.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/ZooKeeper-Server-Hardware-01-100x100.png 100w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><p id=\"caption-attachment-16007\" class=\"wp-caption-text\">Hardware in ZooKeeper<\/p><\/div>\n<h3><span style=\"font-weight: 400\">a. Memory<\/span><\/h3>\n<p><span style=\"font-weight: 400\">Basically, ZooKeeper is not a memory intensive application when handling only data stored by Kafka. Make sure, a minimum of 8 GB of RAM should be\u00a0there for ZooKeeper use, in a typical production use case.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">b. CPU<\/span><\/h3>\n<p><span style=\"font-weight: 400\">As a Kafka metadata, ZooKeeper store does not heavily consume CPU resources. ZooKeeper also offers a latency sensitive function. That implies we must consider providing a dedicated CPU core to ensure context switching is not an issue if it must compete for CPU with other processes.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">c. Disks<\/span><\/h3>\n<p><span style=\"font-weight: 400\">In order to maintain a healthy ZooKeeper cluster, Disk performance is very essential. To perform optimally, we recommend using Solid state drives (SSD) as ZooKeeper must have low latency disk writes.\u00a0<\/span><\/p>\n<h2><span style=\"font-weight: 400\">JVM(Java Virtual Machine)<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Generally, ZooKeeper runs as a<strong> JVM<\/strong>. When running for the Kafka use case, it is not notably heap. For most use cases and monitoring heap usage, we recommend 1 GB heap size to\u00a0stop delays\u00a0due to <strong>garbage collection<\/strong>.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Important Configuration Options for ZooKeeper<\/span><\/h2>\n<p><span style=\"font-weight: 400\">There is no need of configuration tuning for most deployments.\u00a0Some important parameters to consider are:<\/span><\/p>\n<h3><span style=\"font-weight: 400\">a. clientPort<\/span><\/h3>\n<p><span style=\"font-weight: 400\">In this port ZooKeeper, clients will listen on.\u00a0Here we will connect the Brokers to ZooKeeper. Typically this is set to 2181.<\/span><br \/>\n<span style=\"font-weight: 400\">Type: int<\/span><br \/>\n<span style=\"font-weight: 400\">Importance: required<\/span><\/p>\n<h3><span style=\"font-weight: 400\">b. dataDir<\/span><\/h3>\n<p><span style=\"font-weight: 400\">It is the directory where we store ZooKeeper data.\u00a0However, it should be a dedicated disk that is ideally an SSD.<\/span><br \/>\n<span style=\"font-weight: 400\">Type: string<\/span><br \/>\n<span style=\"font-weight: 400\">Importance: required<\/span><\/p>\n<h3><span style=\"font-weight: 400\">c. tickTime<\/span><\/h3>\n<p><span style=\"font-weight: 400\">For ZooKeeper, the unit of time is translated to milliseconds.\u00a0It governs all ZooKeeper time-dependent operations.\u00a0We use it for heartbeats and timeouts especially. <\/span><br \/>\nNote: minimum session timeout will be two ticks.<br \/>\n<span style=\"font-weight: 400\">Type: int<\/span><br \/>\n<span style=\"font-weight: 400\">Default: 2000<\/span><br \/>\n<span style=\"font-weight: 400\">Importance: high<\/span><\/p>\n<h3><span style=\"font-weight: 400\">d. maxClientCnxns<\/span><\/h3>\n<p><span style=\"font-weight: 400\">It is the maximum number of client connections for a ZooKeeper server. Set this to 0 (unlimited), to avoid running out of allowed connections.<\/span><br \/>\n<span style=\"font-weight: 400\">Type: int<\/span><br \/>\n<span style=\"font-weight: 400\">Default: 60<\/span><br \/>\n<span style=\"font-weight: 400\">Importance: high<\/span><\/p>\n<h3><span style=\"font-weight: 400\">e. autopurge.snapRetainCount<\/span><\/h3>\n<p><span style=\"font-weight: 400\">It simply retains the autopurge.snapRetainCount most recent snapshots and the corresponding transaction logs in the dataDir and dataLogDir respectively and also deletes the remaining,\u00a0at the time of enabling it.<\/span><br \/>\n<span style=\"font-weight: 400\">Type: int<\/span><br \/>\n<span style=\"font-weight: 400\">Default: 3<\/span><br \/>\n<span style=\"font-weight: 400\">Importance: high<\/span><\/p>\n<h3><span style=\"font-weight: 400\">f. autopurge.purgeInterval<\/span><\/h3>\n<p><span style=\"font-weight: 400\">It is important that purge task is triggered while the time interval in hours. To enable the auto purging, set it to a positive integer (1 and above).<\/span><br \/>\n<span style=\"font-weight: 400\">Type: int<\/span><br \/>\n<span style=\"font-weight: 400\">Default: 0<\/span><br \/>\n<span style=\"font-weight: 400\">Importance: high<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Monitoring in ZooKeeper &#8211; Kafka<\/span><\/h2>\n<p><span style=\"font-weight: 400\">In order to ensure servers are functioning properly and proactively identify issues, we need to monitor ZooKeeper servers. Best practices for monitoring are:<\/span><\/p>\n<div id=\"attachment_16019\" style=\"width: 510px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Monitoring-in-ZooKeeper-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-16019\" class=\"wp-image-16019 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Monitoring-in-ZooKeeper-1.png\" alt=\"ZooKeeper in Kafka\" width=\"500\" height=\"500\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Monitoring-in-ZooKeeper-1.png 500w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Monitoring-in-ZooKeeper-1-150x150.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Monitoring-in-ZooKeeper-1-300x300.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Monitoring-in-ZooKeeper-1-100x100.png 100w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><p id=\"caption-attachment-16019\" class=\"wp-caption-text\">Monitoring in ZooKeeper<\/p><\/div>\n<h3><span style=\"font-weight: 400\">a. Operating System<\/span><\/h3>\n<p><span style=\"font-weight: 400\">When the ZooKeeper service will start to struggle, the underlying OS metrics can help predict. We should monitor:<\/span><\/p>\n<h4><strong>i. Number of open file handles<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">This should be done system-wide and for the user running the ZooKeeper process. Values should be considered with respect to the maximum allowed number of open file handles.\u00a0It also opens and closes connections often, and moreover, it needs an available pool of file handles to choose from.<\/span><\/p>\n<h4><strong>ii. Network bandwidth usage <\/strong><\/h4>\n<p><span style=\"font-weight: 400\">ZooKeeper is sensitive to timeouts caused by network latency just because it keeps track of state. If somehow the network bandwidth is saturated then only it is possible that we may experience hard to explain timeouts with client sessions, although that\u00a0results\u00a0in making <strong>Kafka cluster<\/strong> less reliable.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">b. \u201cFour Letter Words\u201d<\/span><\/h3>\n<p><span style=\"font-weight: 400\">Basically, ZooKeeper\u00a0only response to a set of commands, each one is of four letters.\u00a0 To run the commands\u00a0we must send a message (via netcat or telnet) to the ZooKeeper client port. For example echo stat | nc localhost 2181 would return the output of the STAT command to stdout.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">c. JMX Monitoring<\/span><\/h3>\n<p><span style=\"font-weight: 400\">JMX metrics that are important to monitor:<\/span><br \/>\n<strong>NumAliveConnections\u00a0<\/strong><br \/>\n<strong>OutstandingRequests\u00a0<\/strong><br \/>\n<strong>AvgRequestLatency\u00a0<\/strong><br \/>\n<strong>MaxRequestLatency\u00a0<\/strong><br \/>\n<strong>HeapMemoryUsage (Java built-in)\u00a0<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Moreover, by the SessionExpireListener, Kafka, tracks the number of relevant ZooKeeper events. Basically, it is monitored to ensure the health of ZooKeeper-Kafka interactions:<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>ZooKeeperAuthFailuresPerSec<\/strong> (secure environments only)<\/span><br \/>\n<strong>ZooKeeperDisconnectsPerSec<\/strong><br \/>\n<strong>ZooKeeperExpiresPerSec<\/strong><br \/>\n<strong>ZooKeeperReadOnlyConnectsPerSec<\/strong><br \/>\n<strong>ZooKeeperSaslAuthenticationsPerSec (secure environments only)<\/strong><br \/>\n<strong>ZooKeeperSyncConnectsPerSec<\/strong><\/p>\n<h2><span style=\"font-weight: 400\">ZooKeeper Multi-node Setup<\/span><\/h2>\n<p><span style=\"font-weight: 400\">The ZooKeeper servers deploy on multiple nodes, in a real production environment. This is\u00a0what we call an ensemble. Basically, an ensemble is a set of 2n + 1 ZooKeeper servers, where n refers to any number greater than 0. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Also, to perform majority elections for leadership, the odd number of servers allows ZooKeeper. There can be up to n failed servers in an ensemble and the ZooKeeper cluster will keep the quorum.\u00a0<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Post Deployment<\/span><\/h2>\n<p><span style=\"font-weight: 400\">ZooKeeper largely runs without much maintenance, once we deploy our ZooKeeper cluster.<\/span><br \/>\nSo, this was all about ZooKeeper role in Kafka, Hope you like our explanation.<\/p>\n<h2><span style=\"font-weight: 400\">Conclusion<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Hence, in this role of ZooKeeper in Kafka tutorial, we have seen that Kafka really needs ZooKeeper to work efficiently in the Kafka cluster. In conclusion, we have learned that all Kafka broker configuration stores in ZooKeeper zNodes.<\/span><\/p>\n<p><span style=\"font-weight: 400\"> Even the Kafka consumers need Zookeeper to know\u00a0about the last consumed message. Moreover, we also studied ZooKeeper server monitoring, hardware in the ZooKeeper server. <\/span><\/p>\n<p><span style=\"font-weight: 400\">At last, we discussed important configurations options for ZooKeeper. However, if any doubt occurs, regarding ZooKeeper in Kafka, feel free to ask in the comment section.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, we will see the Role of Zookeeper in Kafka. This article contains why ZooKeeper is required in Kafka. We can say, ZooKeeper is an inseparable part of Apache Kafka. Before knowing the role&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":73646,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[5365,5909,7975,7976,7977,8865,11631,13710,16041,16387,16394,16401],"class_list":["post-15347","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kafka","tag-hardwares-in-zookeeper-server","tag-how-kafka-talk-to-zookeeper","tag-kafka-zookeeper","tag-kafka-zookeeper-confi","tag-kafka-zookeeper-configuration","tag-monitoring-in-zookeeper","tag-role-of-zookeeper-in-kafka","tag-stable-version-of-zookeeper","tag-what-is-zookeeper","tag-zookeeper-in-kafka","tag-zookeeper-kafka-tutorial","tag-zookeeper-multinode-setup"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Role of Apache ZooKeeper in Kafka - Monitoring &amp; Configuration - DataFlair<\/title>\n<meta name=\"description\" content=\"Role of ZooKeeper in Kafka,what is ZooKeeper,Kafka Zookeeper confi,monitoring in ZooKeeper,Kafka talk to ZooKeeper,Why Kafka require ZooKeeper\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Role of Apache ZooKeeper in Kafka - Monitoring &amp; Configuration - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Role of ZooKeeper in Kafka,what is ZooKeeper,Kafka Zookeeper confi,monitoring in ZooKeeper,Kafka talk to ZooKeeper,Why Kafka require ZooKeeper\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-30T06:24:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Role of Apache ZooKeeper in Kafka - Monitoring &amp; Configuration - DataFlair","description":"Role of ZooKeeper in Kafka,what is ZooKeeper,Kafka Zookeeper confi,monitoring in ZooKeeper,Kafka talk to ZooKeeper,Why Kafka require ZooKeeper","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/","og_locale":"en_US","og_type":"article","og_title":"Role of Apache ZooKeeper in Kafka - Monitoring &amp; Configuration - DataFlair","og_description":"Role of ZooKeeper in Kafka,what is ZooKeeper,Kafka Zookeeper confi,monitoring in ZooKeeper,Kafka talk to ZooKeeper,Why Kafka require ZooKeeper","og_url":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-05-30T06:24:06+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Role of Apache ZooKeeper in Kafka &#8211; Monitoring &amp; Configuration","datePublished":"2018-05-30T06:24:06+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/"},"wordCount":1670,"commentCount":4,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg","keywords":["Hardwares in zookeeper server","How Kafka talk to ZooKeeper","Kafka zookeeper","kafka zookeeper confi","kafka zookeeper configuration","Monitoring in ZooKeeper","role of zookeeper in kafka","Stable Version of ZooKeeper","what is zookeeper","ZooKeeper in Kafka","zookeeper kafka tutorial","ZooKeeper multinode setup"],"articleSection":["Apache Kafka Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/","url":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/","name":"Role of Apache ZooKeeper in Kafka - Monitoring &amp; Configuration - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg","datePublished":"2018-05-30T06:24:06+00:00","description":"Role of ZooKeeper in Kafka,what is ZooKeeper,Kafka Zookeeper confi,monitoring in ZooKeeper,Kafka talk to ZooKeeper,Why Kafka require ZooKeeper","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/role-of-zookeeper-in-kafka.jpg","width":802,"height":420,"caption":"role of zookeeper in kafka"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/zookeeper-in-kafka\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Apache Kafka Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/kafka\/"},{"@type":"ListItem","position":3,"name":"Role of Apache ZooKeeper in Kafka &#8211; Monitoring &amp; Configuration"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/15347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=15347"}],"version-history":[{"count":0,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/15347\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/73646"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=15347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=15347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=15347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}