

{"id":17452,"date":"2018-06-17T04:00:27","date_gmt":"2018-06-17T04:00:27","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=17452"},"modified":"2018-06-17T04:00:27","modified_gmt":"2018-06-17T04:00:27","slug":"hbase-operations","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/hbase-operations\/","title":{"rendered":"HBase Operations: Read and Write Operations"},"content":{"rendered":"<p><span style=\"font-weight: 400\">Today, in this <strong>HBase<\/strong> article &#8220;HBase Operations: Read and Write&#8221; we will learn the whole concept\u00a0of HBase. There are two basic Operations of HBase i.e. HBase read and HBase write. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Moreover, in this HBase tutorial, we will see some major components of HBase Operations such as HFile, META table.<\/span><\/p>\n<p>So let&#8217;s start HBase Operations.<\/p>\n<h2><span style=\"font-weight: 400\">HBase Operations: Read and Write <\/span><\/h2>\n<p><span style=\"font-weight: 400\">Basically, in both data read and write operation of HBase, there are two major components which play a vital role in it, like HFile and META Table, so let\u2019s study about both in detail:<\/span><\/p>\n<h3><span style=\"font-weight: 400\">i. HFile<\/span><\/h3>\n<p><span style=\"font-weight: 400\">A basic level <strong>HBase architecture<\/strong> where the tables exist in physical form is what we call HFile. <\/span><br \/>\n<span style=\"font-weight: 400\">Some key points in HFile:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A primary identifier is a Row key.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Here in lexicographical order, keys are stored.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Data is stored and split across the nodes, according to this order.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Only to 1 region, HFile is allocated.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The rows are stored in HFile, in sorted by KeyValues on disk.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Moreover, the entire sorted set is written to a new HFile in <strong>HDFS<\/strong>, while the MemStore accumulates data more than its limit.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In each column family, HBase uses multiple HFiles, which may consist of actual cells or key-value instances.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In each HFile, the highest sequence number stored as a meta field, to a better state where it has ended previously and where to continue next.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">To search the data without having to read the whole file, HFile contains a multi-layered index which allows HBase.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">HDFS replicates the WAL and HFile blocks.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Also, replication OF HFile block happens automatically.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">By default, IO in HBase happens at HFile block level which is 64KB.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Moreover, HRegion Server controls integrating HFile component to have HRegion.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">ii. META Table<\/span><\/h3>\n<p>META Table is one of the major components of HBase Operations.<\/p>\n<p><span style=\"font-weight: 400\">HBase Read operation needs to know which HRegion server has to be accessed for reading actual data, so, we use META Table in Read operation of HBase.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Moreover, the META Table will have the updated data because, after every Write process, this table is updated for the next Read.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">An HBase table which keeps a list of all regions in the system is META Table.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It is like a binary tree.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Its structure is as follows:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\"><strong>Key:<\/strong>\u00a0Region start key, Region id<\/span><br \/>\n<span style=\"font-weight: 400\"><strong>Values:<\/strong> RegionServer<\/span><\/p>\n<h2><span style=\"font-weight: 400\">HBase Write Path<\/span><\/h2>\n<p><span style=\"font-weight: 400\">These following steps occur in HBase Operations, while the client gives a command to Write:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">At very first, for the fault tolerant purpose, write important logs to Write Ahead Log. Hence, HBase always has WAL to look into, if any error occurs while writing data.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The data to be written is forwarded to MemStore which is actually the RAM of the data node, as soon as the log entry is done. All the data is written in <strong>MemStore<\/strong> which is faster than <strong>RDBMS (Relational databases)<\/strong>.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Afterward, all the data is dumped in HFile, however, the actual data is stored in HDFS. Also, then data stores in HFile directly, if the MemCache is full.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Further, ACK (Acknowledgement) is sent to the client as a confirmation of task completed, as soon as writing data is completed.<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400\">HBase Read Path<\/span><\/h2>\n<p><span style=\"font-weight: 400\">As a client sends a request to <strong>HBase<\/strong>, read process starts. A request is sent to zookeeper which keeps all the status of the distributed system, where HBase is also present.\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">META Table which is present in HRegion Server, Zookeeper has the location for it. Hence, Zookeeper gives the address for the table, at the time a client requests.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Afterward,\u00a0that process continues to META Table after HRegionServer. So, there it gets the region address of table where the data is present to be read.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Further, the process enters the BlockCache where data is present from the previous read. However, the client will get the same data in no time, if a user queries the same records. Also, the process returns to the client with the data as result, if the table is found.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Moreover, data would have been written to HFile sometime back,\u00a0the process starts to search MemStore, if the table is not found. Then, the process returns to the client with the data as result, if it is found.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Furthermore, the process moves forward in search of data within the HFile, if the table is not found. Once the search is completed, the data will be located here, the process takes required data and moves forward.<\/span><\/li>\n<li style=\"font-weight: 400\">Now, make sure, The data which HFile takes is the latest read data and further, it can be read by the user again. The reason that the data is written in BlockCache, is it can be instantly accessed by the client, at the next time.<\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400\">Finally, the read process with required data will be returned to the client along with ACK, while the data is written in BlockCache and all the search is completed.<\/li>\n<\/ul>\n<p>So, this was all about HBase Operations. Hope you like our explanation.<\/p>\n<h2><span style=\"font-weight: 400\">Conclusion<\/span><\/h2>\n<p>Hence, in this HBase Operations tutorial, we have seen how HBase performs Read and Write operations internally. Moreover, we also discussed 2 major components of HBase, these are HFile and META Table in operation of HBase. However, if any doubt occurs, feel free to ask in the comment tab.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, in this HBase article &#8220;HBase Operations: Read and Write&#8221; we will learn the whole concept\u00a0of HBase. There are two basic Operations of HBase i.e. HBase read and HBase write. Moreover, in this HBase&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":18613,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[2812,3410,5381,5461,5474,5491,5500,5627,6412,8486,8654,9262,11360],"class_list":["post-17452","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hbase","tag-components-of-hbase","tag-data-read-and-write-opeartions","tag-hbase","tag-hbase-operations","tag-hbase-read-path","tag-hbase-tutorial","tag-hbase-write-path","tag-hfile","tag-hregion-server","tag-major-components-of-hbase","tag-meta-table","tag-opeartions-of-hbase","tag-read-operation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HBase Operations: Read and Write Operations - DataFlair<\/title>\n<meta name=\"description\" content=\"HBase Operations tutorial: HBase read path,HBase write path,components of HBase,HFile,META Table,HRegion Server,data read &amp; write operations,HBase tutorial\" \/>\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\/hbase-operations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HBase Operations: Read and Write Operations - DataFlair\" \/>\n<meta property=\"og:description\" content=\"HBase Operations tutorial: HBase read path,HBase write path,components of HBase,HFile,META Table,HRegion Server,data read &amp; write operations,HBase tutorial\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/hbase-operations\/\" \/>\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-06-17T04:00:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/HBase-Operations-Read-and-Write-01-1.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":"HBase Operations: Read and Write Operations - DataFlair","description":"HBase Operations tutorial: HBase read path,HBase write path,components of HBase,HFile,META Table,HRegion Server,data read & write operations,HBase tutorial","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\/hbase-operations\/","og_locale":"en_US","og_type":"article","og_title":"HBase Operations: Read and Write Operations - DataFlair","og_description":"HBase Operations tutorial: HBase read path,HBase write path,components of HBase,HFile,META Table,HRegion Server,data read & write operations,HBase tutorial","og_url":"https:\/\/data-flair.training\/blogs\/hbase-operations\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-06-17T04:00:27+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/HBase-Operations-Read-and-Write-01-1.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\/hbase-operations\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"HBase Operations: Read and Write Operations","datePublished":"2018-06-17T04:00:27+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/"},"wordCount":874,"commentCount":3,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/HBase-Operations-Read-and-Write-01-1.jpg","keywords":["components of HBase","data read and write opeartions","hbase","HBase Operations","HBase read path","hbase tutorial","HBase write path","HFile","HRegion Server","major components of HBase","META Table","opeartions of HBase","read operation"],"articleSection":["HBase Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/hbase-operations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/","url":"https:\/\/data-flair.training\/blogs\/hbase-operations\/","name":"HBase Operations: Read and Write Operations - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/HBase-Operations-Read-and-Write-01-1.jpg","datePublished":"2018-06-17T04:00:27+00:00","description":"HBase Operations tutorial: HBase read path,HBase write path,components of HBase,HFile,META Table,HRegion Server,data read & write operations,HBase tutorial","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/hbase-operations\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/HBase-Operations-Read-and-Write-01-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/06\/HBase-Operations-Read-and-Write-01-1.jpg","width":1200,"height":628,"caption":"HBase Operations: Read and Write Operations"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/hbase-operations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"HBase Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/hbase\/"},{"@type":"ListItem","position":3,"name":"HBase Operations: Read and Write Operations"}]},{"@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\/17452","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=17452"}],"version-history":[{"count":0,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/17452\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/18613"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=17452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=17452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=17452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}