

{"id":20611,"date":"2018-07-06T10:18:22","date_gmt":"2018-07-06T10:18:22","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=20611"},"modified":"2021-05-19T18:24:12","modified_gmt":"2021-05-19T12:54:12","slug":"zookeeper-workflow","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/","title":{"rendered":"Apache Zookeeper Workflow: Nodes in a ZooKeeper"},"content":{"rendered":"<p><span style=\"font-weight: 400\">In our last<strong> ZooKeeper tutorial<\/strong>, we discussed <strong>terminologies in ZooKeeper<\/strong>. In this Zookeeper article, we will learn the complete concept of \u00a0Zookeeper Workflow in detail.<\/span><\/p>\n<p><span style=\"font-weight: 400\"> Also, we will see whole about the effect of having the different number of nodes in the ZooKeeper ensemble to understand Workflow of ZooKeeper well.\u00a0<\/span><\/p>\n<p>So, let&#8217;s start ZooKeeper Workflow.<\/p>\n<h2><span style=\"font-weight: 400\">What is Zookeeper Workflow?<\/span><\/h2>\n<p>Basically, it works like, Ensemble will wait for the clients to connect, as soon as a ZooKeeper ensemble starts. Hence, in the ZooKeeper ensemble, clients will connect to one of the nodes. Although that node can be a leader or a follower node.<\/p>\n<p>However, the node assigns a session ID to the particular client and sends an acknowledgment to the client, once a client is connected.<\/p>\n<p>Moreover, Client simply tries to connect to another node in the ZooKeeper ensemble, if the client does not get an acknowledgment. Further, the client will send heartbeats to the node in a regular interval to make sure that the connection is not lost, once connected to a node.<\/p>\n<div id=\"attachment_20641\" style=\"width: 1677px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeeper-Workflow.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-20641\" class=\"wp-image-20641 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeeper-Workflow.png\" alt=\"Zookeeper Workflow\" width=\"1667\" height=\"872\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeeper-Workflow.png 1667w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeeper-Workflow-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeeper-Workflow-300x157.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeeper-Workflow-768x402.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeeper-Workflow-1024x536.png 1024w\" sizes=\"auto, (max-width: 1667px) 100vw, 1667px\" \/><\/a><p id=\"caption-attachment-20641\" class=\"wp-caption-text\">Zookeeper Workflow<\/p><\/div>\n<p>What is Zookeeper Workflow<strong>Do you know the reason for the popularity of Apache ZooKeeper<\/strong><\/p>\n<p><span style=\"font-weight: 400\">In addition, there is a condition like when\u00a0a client wants to read a particular Znode at that time it sends a read request to the node with the Znode path and the node returns the requested Znode by getting it from its own database. <\/span><span style=\"font-weight: 400\">Hence, we can say reads are fast in ZooKeeper ensemble, for this reason.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Moreover, it sends the Znode path and the data to the server, if a client wants to store data in the ZooKeeper ensemble. Furthermore, the leader will reissue the writing request to all the followers just after the connected server will forward the request to the leader. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Also, the write request will succeed and a successful return code will be sent to the client if only a majority of the nodes respond successfully. Else, the write request will fail. Moreover, the strict majority of nodes is what we call a Quorum.<\/span><\/p>\n<h3>a. Nodes in a ZooKeeper Ensemble<\/h3>\n<p><span style=\"font-weight: 400\">There can be the different number of nodes in the ZooKeeper ensemble. So, let us analyze the effect of changing the nodes in ZooKeeper Workflow:<\/span><\/p>\n<ol>\n<li><span style=\"font-weight: 400\">The ZooKeeper ensemble fails when that node fails if we have a single node. That&#8217;s why it\u00a0is not recommended in a production environment because it contributes to \u201cSingle Point of Failure\u201d.<\/span><\/li>\n<li><span style=\"font-weight: 400\">We don\u2019t have the majority if we have two nodes and one node fails, because one out of two is not a majority.<\/span><\/li>\n<li><span style=\"font-weight: 400\">As if\u00a0one node fails if we have three nodes, then we have the majority which is the\u00a0least requirement.\u00a0And\u00a0to have at least three nodes in a live production environment is mandatory for a ZooKeeper ensemble.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Four nodes are similar to having three nodes because two nodes fail because if we have four nodes and if two nodes fail, then it fails again. That&#8217;s why\u00a0it is better to add nodes in odd numbers, e.g., 3, 5,7\u00a0because extra node does not serve any purpose.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">Since all the nodes need to write the same data in its database, a write process is expensive than a read process in the ZooKeeper ensemble. Hence, having a large number of nodes for a balanced environment is better to have less number of nodes (3, 5 or 7).<\/span><\/p>\n<h4>i. Write<\/h4>\n<p><span style=\"font-weight: 400\">Basically, leader node handles write process. In addition, to all the Znodes, leader forwards the write request and then waits for answers from the znodes. You can be sure about the writing process is complete if half of the Znodes reply.<\/span><\/p>\n<h4>ii. Read<\/h4>\n<p><span style=\"font-weight: 400\">By a specifically connected Znode, reads are performed internally,\u00a0hence we do not need interaction with the cluster.<\/span><\/p>\n<h4>iii. Replicated Database<\/h4>\n<p><span style=\"font-weight: 400\">In zookeeper, to store data we use Replicated Database. However, every Znode has the same data at every time with the help of consistency and each Znode has its own database.<\/span><\/p>\n<h4>iv. Leader<\/h4>\n<p><span style=\"font-weight: 400\">For processing write requests, the leader is the Znode\u00a0which is responsible.<\/span><\/p>\n<h4>v. Follower<\/h4>\n<p><span style=\"font-weight: 400\">Generally, it receives write requests from the clients and then forwards them to the leader Znode.<\/span><\/p>\n<h4>vi. Request Processor<\/h4>\n<p><span style=\"font-weight: 400\">In the leader node, it is present. And, from the follower node, it governs write requests.<\/span><\/p>\n<h4>vii. Atomic Broadcasts<\/h4>\n<p><span style=\"font-weight: 400\">The reasons\u00a0behind changes from the leader node to the follower nodes are Atomic broadcasts.<\/span><br \/>\nSo, this was all in ZooKeeper Workflow. Hope you like our explanation.<\/p>\n<h2><span style=\"font-weight: 400\">Conclusion<\/span><\/h2>\n<p>Hence, we have seen the concept of Zookeeper Workflow in detail. Moreover, in this workflow of ZooKeeper, we discussed different nodes in a ZooKeeper assemble. Still, if any doubt occurs regarding ZooKeeper Workflow, ask in the comment tab.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our last ZooKeeper tutorial, we discussed terminologies in ZooKeeper. In this Zookeeper article, we will learn the complete concept of \u00a0Zookeeper Workflow in detail. Also, we will see whole about the effect of&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":20712,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[1217,4849,6408,8123,11354,11540,11561,16041,16235,16292,16556],"class_list":["post-20611","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-zookeeper","tag-atomic-broadcasts","tag-follower","tag-how-zookeeper-is-used","tag-leader","tag-read","tag-replicated-database","tag-request-processor","tag-what-is-zookeeper","tag-workflow-of-zookeeper","tag-write","tag-zookeeper-workflow"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Apache Zookeeper Workflow: Nodes in a ZooKeeper - DataFlair<\/title>\n<meta name=\"description\" content=\"ZooKeeper WorkFlow Tutorial: what is the Workflow of ZooKeeper, Nodes in a ZooKeeper Ensemble, write,read,replicated dtabase,follower,atomic broadcastd\" \/>\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-workflow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apache Zookeeper Workflow: Nodes in a ZooKeeper - DataFlair\" \/>\n<meta property=\"og:description\" content=\"ZooKeeper WorkFlow Tutorial: what is the Workflow of ZooKeeper, Nodes in a ZooKeeper Ensemble, write,read,replicated dtabase,follower,atomic broadcastd\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/\" \/>\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-07-06T10:18:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-19T12:54:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeepe-Workflow-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\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=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Apache Zookeeper Workflow: Nodes in a ZooKeeper - DataFlair","description":"ZooKeeper WorkFlow Tutorial: what is the Workflow of ZooKeeper, Nodes in a ZooKeeper Ensemble, write,read,replicated dtabase,follower,atomic broadcastd","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-workflow\/","og_locale":"en_US","og_type":"article","og_title":"Apache Zookeeper Workflow: Nodes in a ZooKeeper - DataFlair","og_description":"ZooKeeper WorkFlow Tutorial: what is the Workflow of ZooKeeper, Nodes in a ZooKeeper Ensemble, write,read,replicated dtabase,follower,atomic broadcastd","og_url":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-07-06T10:18:22+00:00","article_modified_time":"2021-05-19T12:54:12+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeepe-Workflow-01.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Apache Zookeeper Workflow: Nodes in a ZooKeeper","datePublished":"2018-07-06T10:18:22+00:00","dateModified":"2021-05-19T12:54:12+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/"},"wordCount":791,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeepe-Workflow-01.jpg","keywords":["Atomic broadcasts","Follower","How ZooKeeper is used","Leader","read","Replicated Database","Request Processor","what is zookeeper","WorkFlow of ZooKeeper","write","Zookeeper Workflow"],"articleSection":["Zookeeper Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/","url":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/","name":"Apache Zookeeper Workflow: Nodes in a ZooKeeper - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeepe-Workflow-01.jpg","datePublished":"2018-07-06T10:18:22+00:00","dateModified":"2021-05-19T12:54:12+00:00","description":"ZooKeeper WorkFlow Tutorial: what is the Workflow of ZooKeeper, Nodes in a ZooKeeper Ensemble, write,read,replicated dtabase,follower,atomic broadcastd","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeepe-Workflow-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Zookeepe-Workflow-01.jpg","width":1200,"height":628,"caption":"Apache Zookeeper Workflow: Nodes in a ZooKeeper"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/zookeeper-workflow\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Zookeeper Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/zookeeper\/"},{"@type":"ListItem","position":3,"name":"Apache Zookeeper Workflow: Nodes in a ZooKeeper"}]},{"@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\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/20611","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\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=20611"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/20611\/revisions"}],"predecessor-version":[{"id":94238,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/20611\/revisions\/94238"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/20712"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=20611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=20611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=20611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}