1. Home
  2. Explore
  3. Computer Science
  4. Hadoop Overview

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Hadoop Overview

Transcript

Hey everyone, this is Reshma from Edureka and in today's tutorial we're going to focus on Hadoop. Thank you all the attendees for joining today's session. I hope that you'll all enjoy this session but before I begin I want to make sure that you all can hear me properly so kindly drop me a confirmation on the chat window so that I can get started. Alright, so I've got a confirmation from Kanika Neha Keshav there's Jason Sebastian okay so we'll start by looking at the topics that we'll be learning today. So we'll start by learning the big data growth drivers, the reasons because of which data has been converting into big data. Then we'll take a look at what is big data and we'll take a look at the solution of big data which is Hadoop. So we'll also see the master/slave architecture of Hadoop and the different hadoop core components, we'll also study how HDFS stores data into data blocks

and how the read/write mechanism works in HDFS. Then we'll understand the programming part of Hadoop which is known as MapReduce and we'll understand this with a MapReduce program we'll understand the entire MapReduce job workflow and we'll see the Hadoop ecosystem the different tools that the Hadoop ecosystem comprises of and finally we'll take in a use case where we'll see how Hadoop has solved all the big data problems in real life. So I hope that the agenda is clear to everyone, all right then it seems that everyone is clear with the agenda so we'll get started and we'll begin with the big data growth drivers. Now the reasons behind the growth of big data could be numerous ever since the enhancement of technology data has also been growing every day now if you go back in time like in 70s or 80s not many people were using computers there were only a fraction of people who are dealing with

computers and that's why the data fed into computer systems was also quite less but now everyone owns the gadget everyone has a mobile phone everyone owns a laptop and they are generating data from there every day you can also think of Internet of Things as a factor nowadays we are dealing with smart devices we have smart appliances that are interconnected and they form a network of things which is nothing but internet of things so these smart appliances are also generating data when they're trying to communicate with each other and one prominent factor behind the rise of big data that comes to our mind is social media we have billions of people on social media because we human we are social animals and we love to interact we love to share our thoughts and feelings and social media website provides us just the platform that we need and we have been using it

extensively every day so if you look at the stats in front of your screen so you can see that in Facebook the users generates almost 4 million likes every 60 seconds similarly on Twitter there is almost 300 thousand tweets every 60 seconds on reddit there is 18,000 user cast votes on Instagram there are more than 1 million likes and on YouTube there is almost 300 hours of new video uploaded every 60 seconds now this is data for every 60 seconds you can imagine the kind of data that we are dealing with every day and how much data we have accumulated throughout the years ever since the social media website have started now that's a lot of data and it has been rising exponentially over years so let's see what Cisco has to tell about this now you all know that Cisco is one of the biggest networking companies and they have monitored the data traffic they have been getting over years and they have published this on

their white paper which they publish every year and we can see from here the stats that they have provided that by 2020 we'll be dealing with 30.6 exabytes of data now one exabyte is 10 raised to the power 18 bytes now that's a lot of zeros that even you can think of. In 2015 if you see that we were only dealing with 3.7 exabytes and now in just five years we're going up to 30.6 exabytes now it can be more in the coming years because the data has been rising exponentially and we are dealing with a lot of data now and cisco has also mentioned the three major reasons because of the rise of the data now the first one is adapting to smarter mobile devices now gone are the days when we were using phones like Nokia 1100 which is able to only call people and to receive calls and just send a few lines of text messages nowadays everyone is using smartphones and we are using different

apps and our phones so each of the app is generating a lot of data. The next reason that they have mentioned is defining cell network advances now earlier we had 2G now we had come with 3G and 4G and we're looking forward to 5g now to time we are advancing in the cellular network technology also and it has made us feasible for us to communicate even faster and in a better way and that's why since I already told you that we love to share things it has become very easy for us to send a message or send videos or any kind of files to our friend who is even countries apart and it takes only a few seconds not even seconds milliseconds for that person to receive that message and that is why we're using it extensively because of the ease of the use that we are getting provided and the next reason that they have mentioned is reviewing tiered pricing now the network companies are also providing you with a

lot of data plans that your entire family can use now we have unlimited data plans and shared plans which is very feasible for us again and that's why we're using it extensively so there are a lot of mobile users nowadays now the stats also say that we have 217 new users every 60 seconds so you can imagine that almost out of the world population almost everyone uses a mobile phone now well almost so you can say that we are dealing with a lot of data and that is why the main comes as big data so now let us see what is big data now as the name goes big and data you already understood that it is a large cluster of data that we are dealing with but if you ask me I see it as a problem statement that surrounds the in capabilities of a traditional system to process it so when the traditional systems were created we never thought that we'll have to deal with such amount of data and such kind

of data so they are unable to process this amount of data that is being generated and with such a high speed and that's why big data is a problem because a traditional system are not able to store the big data and process it now since I told you that big data is a problem so IBM have suggested 5vs in order to identify a big data problem and those are in front of your screen so the first one is "volume" so it implies that the amount of data the client is using is so huge that it becomes

increasingly difficult for the client or customer to store the data into the traditional systems and then is the time that we should approach for a solution and the next V we'll talk about is "variety" now we already know that we are dealing with huge volume of data with exabytes of data but these are coming from a variety of sources now we're dealing with mp3 files we're dealing with video files images JSON now they are of all different kinds so the mp3 files and video files they are all unstructured data JSON files are semi structured and there are some structured data as well but the major problem is that most of the data almost 90% of the data is unstructured so should we just dump all those unstructured data or should we make use of it obviously we should make use of it because those unstructured data that we are talking about because in facebook we mostly share photos videos which are

unstructured those are very important data because these are used by companies to make business decisions that is gained by insights so this data provide the companies an opportunity to profile their customers because in facebook you go around liking different pages and that is profiling because now the company knows that what kind of things you like and they could approach you by advertising because in facebook you can see that when you're browsing onto your newsfeed on the right-hand side there are certain apps popping up and you'll find out that those ads are also users specific they know what kind of things you like because you have browsed through different pages on Facebook on Google or many other websites so that is why these unstructured data which comprises up the 90% of data is very very important and this is also a problem because our traditional systems are incapable of

processing this unstructured data. The next V that comes up is "velocity" so let's talk about the webservice to understand this case so if you create a web service and you provide the web service for clients to access so how many events the web service can handle at a point of time so you can say maybe thousand or two thousand so generally there will be almost two thousand live connections at any point of time on an average normally there is always a restriction to the number of live connections available at that point so you suppose that your company has a threshold of five hundred transactions at a point of time and that is your upper limit but today you cannot have the amount of number in the big data world you talk about sensors you talk about the Sheen's that is continuously sending you information like GPS is continuously sending you the information to somebody you're talking about

millions and billions of even strikes per second on real time so you need some extended capabilities which withstand that amount of velocity that data is getting dumped into your traditional systems so if you think that the velocity can be a challenge to your customer then you propose them again a big data solution because this is again a big data problem. Now the next V that we'll talk about is "value" now if your data set cannot give you the necessary information which you can use to gain insights and develop your business then it's just garbage to you because it is very important that you have the right data and you can extract the right information from out of it now there might be unnecessary data lying around in your data set that is unnecessary for you now you'll also have to be able to identify which data set will give you the value that you need in order to develop your business so that is again a

problem in order to identify the valuable data and hence it is again a big data problem and finally we'll talk about "veracity" so veracity talks about the sparseness of data so in simple words veracity says that you cannot expect the data to be always correct or reliable in today's world you might get few data which has missing values you may have to work with various types of data that is incorrect or data which may not always hold true so in other words veracity means that you have to trust and make the system to have an understanding that the data may not always be correct and up to the standards it is up to you as an application developer that you have to integrate the data and flush out those data that does not make any sense and extract only those data that makes sense to you and use those data for making decision at the end so these are the five Z's that will help you to identify

a big data problem whether your data is big data or not and then you can find the approach for a solution for it so this was an introduction to big data so now we'll understand the problems of big data and how you should approach for a solution for it with a story that you can relate to so I hope that you'll find this part very interesting. So this is a very typical scenario so this is Bob and he has opened up a very small restaurant in a city and he attired a waiter for taking up orders and this is the chef who cooks all those orders and finally delivers them to the customers now what happens here is that this is the cook and he has access to a food shelf and this is where he gets all the ingredients from in order to cook a particular dish now this is the traditional scenarios so he's getting two orders per hour and he's able to cook two dishes per hour so it's a happy situation for him so he's cooking

happily the customers are getting served because there are only two orders per hour and he has got all the time he has got access to the food shelf also it's a happy day similarly if we compare the same scenario with your traditional processing system so data is also being generated at a very steady rate and all the data that is being generated is also structured which is very easy for our traditional system to process it so it's a happy day for the traditional processing system too. Now let us talk about a different day so this is the other scenario so Bob decided to take online orders now and now they are receiving much more orders than expected so from two orders per hour now the orders have rised to ten orders per hour and now he has to cook ten dishes every hour so this is quite a bad situation for the cook because he is not capable of cooking ten dishes every hour where beforehand he was only doing two dishes

every hour so now consider the scenario of our traditional processing system too so there are a huge number and huge variety of data that is being generated at alarming rate they have already seen the stats that I just showed you that in every 60 seconds how much data is being generated so the velocity is really high and they are all unstructured data and our traditional processing system is not capable of doing that so it's a bad day for our processing system too so now what should be the solution for it so I would ask you guys so what should Bob do right now in order to service customers without delay all right so I'm getting some answers so Sebastian is saying that Bob should hire more cooks and exactly Sebastian you are correct so the issue was that there were too many orders per hour so the solution would be hire multiple cooks and that is exactly what Bob did so he hired four more cooks and

now he has five cooks and all the cooks have access to the food shelf this is where they all get their ingredients from so now there are multiple cooks cooking food even though there are ten orders per hour maybe each cook is taking two orders every hour and they're serving people but there are issues still there now because there is only one food shelf and there might be situations like both of the coasts maybe let's say these two cooks one the same ingredient at the same time and they are fighting over it or and the other cooks have to wait until one of the cooks have taken all the ingredients from the food shelf and by that time maybe he has got something on the stove and it has already burned because he was waiting for the other cook to go so that he can get his hands on the ingredient that he wants so again it is a problem so now let us consider the same situation with their traditional

processing system so now we have got multiple processors in order to process all the data which was being problematic so it should solve the problem right but again there is a problem because all this processing units are accessing data from a single point which is the data warehouse so bringing data to processing generates a lot of network overhead there would be a lot of input/output overhead and there would be a network congestion because of that and sometimes

there might be of situations like processing unit is downloading data from the data warehouse and the other units have to wait in queue in order to access that data and this will completely fail when you want to perform near real-time processing when situations are like this that is why this solution will fail - so then what should be the solution so can I get a few answers okay so geisha says that it should be distributed and parallel you are right

geisha flow since the food shelf is becoming a bottleneck for Bob so the solution was to provide a distributed and parallel approach so we'll see how Bob did that so as a solution what Bob did is that he divided up an order into different tasks so now let us consider the example of meat sauce let's say that a customer has come into Bob's restaurant and he has ordered a meat sauce so what happens in Bob's kitchen now is that each of the chefs have got different tasks so let's say in order to prepare meat sauce this chef over here he only cooks meat and this chef over here he only cooks sauce and he has also hired a head chef in order to combine the meat and the sauce together and finally serve the customer so this cooks cook the meat and these two cooks prepare the sauce and they are doing this parallely at the same time and finally this head chef merges the order and the order is completed now if you

remember that the food shelf was also a bottleneck so what Bob did in order to solve this is that he distributed the food shells in such a way that a chef has got his access to his own shelf so this shelf over here holds all the ingredients that this chef might need and similarly he has got three more shelves that has got the same ingredients now again let's say that we have a problem that one of the cooks falls sick so in that case we don't have to worry much since we have got another cook who can also cook meat so we can tackle this problem very easily and similarly let's say there comes another problem where a food shelf breaks down and this cook over here has no access to ingredients so again we don't have to worry since there are three more shelves and at that time of disaster we have a backup of three more shelves so he can go ahead and use ingredients from any of the shelves over here so basically we

have distributed and made parallel the whole processor tasks into smaller tasks and now there is no problem in bulks restaurant is able to service customers happily let me relate the situation with her we're and let us consider where I've told you that each of the chef's has got his own food shelf in Hadoop terms this is known as data locality it means that data is locally available into the processing units and this whole thing where all the different tasks of cooking meat and sauce are happening parallely this is known as map in Hadoop terms and when they're finally merged together and finally we have got a meat sauce as a dish by the head chef this is known as reduced and we'll be learning MapReduce in Hadoop later on this tutorial don't get confused with the terms if I'm speaking it right now and you're not able to understand it you'll be clear at this end of this tutorial I promise you

that so now he is able to handle all the ten online orders per hour and even at times let's say on Christmas or New Year even if Bob is getting more customers more than ten orders per hour this system that he has developed it is scalable he can hire more chefs more head chef in that case in order to serve more orders per hour this is a scalable system so you can scale up and scale down whenever he needs he can hire more chefs he can fire more chefs whenever he needs so this is the ultimate solution that Bob had and this is very effective indeed but now ball has solved all these problems but have we solved all the problems do we have a framework like that who could solve all the big data problems of storing it and processing it well the answer is yes we have something called Apache Hadoop and this is the framework to process big data so let us go ahead and see Apache Hadoop in detail so Hadoop is a framework that allows us

to store and process large data sets in parallel and distributed fashion now you know that there are two major problems in dealing with big data the first one was storage so in order to solve the storage problem of big data we have got HDFS because like how Bob's solve the food shelves problem by distributing it among the chefs similarly Hadoop solves the storing of big data with HDFS which stands for Hadoop distributed file system so now all the big amount of data that we are dumping is it's distributed over different machines and these machines are interconnected on which our data is getting distributed and in Hadoop terms it is called a Hadoop cluster and again like how Bob has managed to divided the tasks among his chefs and need the serving process quite quicker similarly in order to process Big Data we have something called MapReduce and this is the programming unit of Hadoop so this allows a parallel and distributed

processing of data that is lying across our Hadoop cluster so every machine in the Hadoop cluster it processes the data that it's got and this is known as map finally when the intermediary outputs are combined in order to provide the final output this is called reduce and hence MapReduce so now let us understand the Hadoop architecture which is a master/slave architecture and we'll understand it by taking a very simple scenario which I'm very sure that you'll all relate to very closely so this is a scenario which is usually found in every other company so we have a project manager here and this project manager handles a team of four people so the four people here in our example are John James Bob and Alice so whatever project he gets from a client he distributed it crossed his team members and tracks a report of how the work is going on from time to time so now let us consider that the project

manager over here he has received four projects from a client so let's say the projects are a B C and D and he has assigned all these projects across the team so John is called project a James has got project B bob has got see Alice's got D so everyone is handling and working on a different project and the work is going on fine so he's quite sure that he'll be able to meet the deadlines and deliver the project in time but there is a problem Bob applied for a leave and he tells the project manager that I'm going on leave for a week or two and I won't be coming an office and I can't do the work and now it is a problem for the project manager because at the end he is liable for the work that has not been completed to the client so this person has to make sure that all the projects are delivered at time so it thinks off plan because he's a very clever fellow so in order to tackle this problem what the project

manager does he goes to John and he tells him hey John how are you doing and John says yeah I'm doing great yeah I heard that you're doing really great and you're doing excellent in your project the John said things that something's fishy why is appreciating me so much today then the project manager goes ahead and tells him so John since you're doing so well why did you take up the project see as well and the John things okay that's it and then it replies back to the manager that no I'm fine with my project that I've got I have a lot of work to do already I don't think I can take project C then the project manager says no no no you've got me wrong you don't have to work on projects see you know that bob is already working on project C well you can keep it as your backup project and you might never know that you might not have to even work at the end at project C but you'll get the credit for both the

projects at the end and I could refer you for a substantial hike and then John thinks it's a quite good deal he might not even have to work on it and he'll get a hike for that so that's why Greece and it takes up project C so now the project manager has done its job he doesn't have to worry about completing projects see even if Bob is going out of town and this is a very very clever fellow in order to tackle even future problems what he does he goes to each of the members and tells them the same thing and hence now he has got a backup for all the different projects so if any of the members ever even opted out of the team he has got a backup and this is how a project manager completes all his tasks at the given time and the client is satisfied and then he also makes sure that he has updated his list as well in order to know who is carrying the back of projects as well and this is exactly what happens in Hadoop so we have got a

master node that supervises the different slave nodes the master node keeps a track record of all the processing that is going on in slave nodes and in case of disaster if any of those goes down the master know has always got a backup now as we compare this whole office situation to our Hadoop cluster this is what it looks like so this is the master node this is the project manager in case of our office and these are the processing units where the work is getting carried out so this is exactly how Hadoop processes and Hadoop manages Big Data using the master slave architecture so understand more about the master node and the slave nodes and detail later on in this tutorial so any doubts till now right so now we'll move ahead and we'll take a look at the Hadoop core components and we're going to take a look at HDFS first which is the distributed file system in Hadoop so at first let's take a look at the two

components of HDFS since we're already talking about master and slave nodes so let us take a look at what is name node and data node so these are the components you'll find in HDFS so since we're already talking about a master/slave architecture so the master node is known as the name node and slave nodes are known as data node so the name node over here this maintains and manages all the different data nodes which are slave nodes just like our project manager manages a team and like how you guys report to your manager about your work progress and everything the data nodes also do the same thing by sending signals which are known as heartbeats now this is just a signal to tell the name node that the data node is alive and working fine now coming to the data node so this is where your actual data is stored so remember when we talked about storing data in a distributed fashion across different

machines so this is exactly where your data is distributed across and it is stored in data blocks so the data node over here is responsible for managing all your data across data blocks and these are nothing but these are slave daemons and the master daemon is the name node but here you can see another component over here which is the secondary name node and by the name you might be guessing that this is just a backup for the name node like when the name node might crash so this will take over but actually this is not the purpose of secondary name though the purpose is entirely different and I'll tell you what is that you just have to keep patience for a while and I'm very sure that you'll be intrigued to know about how important the secondary name node is so now let me tell you about the secondary name node well since we're talking about metadata which is nothing but information about our data it

contains all the modifications that had took place across the Hadoop cluster or our HDFS namespace and this metadata is maintained by HDFS using two files and those two files RSS image and edit log now let me tell you what are those so f is image this file over here this contains all the modifications that have been made across your Hadoop cluster ever since the name node was started so let's say the name node was started 20 days back so my FS image will contain all the details of all the changes that happen in ask 20 days so obviously you can imagine that there will be a lot of data contained in this find over here and that is why we store the essence image on our disk so you'll find this SS image file in the local disk of your name node machine now coming to edit log so this file also contains metadata that is the data about your modifications but it only contains the most recent changes

let's say whatever modifications that took place in the past one are and this file is small and this file resides in the RAM of your name load machine so we have the secondary name node here which performs a task known as checkpointing now what is checkpointing it is the process of combining the edit log with the FS image and how is it done so the secondary name node over here has got a copy of the edit log and the SS image from the name node and then it adds them up in order to get a new FS image so why do we need a new FS image we need an updated file of the FS image in order to incorporate all the recent changes also into our SS image file and why do we need to incorporate it regularly let's say that if you're maintaining all the modifications in your edit lock you know that your edit log resides in your lab so you cannot let your edit log file to grow bigger because as time passes you'll be making more modifications and

more changes and this will get stored in the edit log only first so that's why the file gets bigger it might end up taking a lot of space in your RAM and we'll make the processing power of the name node quite slower and also during the time of failure let's say that your name node has failed and you want to set up a new name node you've got all the files that is needed in order to set up a new name though you've got the most updated recent copy of the SS image all the metadata that you need about your data nodes that your name node is managing so that will be found in your secondary name node and that's why your failure recovery time will grow much lesser and then you'll not lose much data or much time in order to set up a new name node and my default the checkpoint thing happens every hour and by the time when the checkpoint is happening you might be making some more changes also so those changes are stored

in a new edit and until the next checkpoint happens we'll be maintaining a new edit log file that will again contain all the recent changes since the last checkpoint so this will be ready log in again when we are performing checkpoint again so we'll take in all the modifications all the data in this edit log and then combine it with the last SS image that we had so this checkpoint thing keeps on going on and by default it takes place every one R if you want the checkpoint thing to happen in minimum intervals you can also do that if you wanted after a long time you can also configure it so we have studied about the HDFS components we have taken a look at what is name node and how does it manage all the data nodes we have also seen the functions of secondary name nodes now so now let us see how all this data is actually stored in all the data nodes so HDFS is a block structured file system and each file is

divided into a block of particular size and by default that size is 128 mV so let us understand how HDFS stores files and data blocks with an example so suppose a client wants to store a file which is of 380 MB and he wants to store it in a Hadoop distributed file system so now what H DSS will do is that it will divide up the file into three blocks because 380 MB divided by 128 MB which is the default size of each data block is approximately three so here the

first block will occupy 128 MB the second block will also occupy 128 MB and the third block will be of the remaining size of the file which is 124 MB so after my file has been divided into data blocks this data blocks will be distributed across all the data nodes that is present in mojado clustered here you can see that the first part of my file which is 128 MB is indeed a node 1 the next data block is in my data node 2 and my final data block is an data node 3 and if you notice the size of all the blocks are same except for the last one so this is a 124 MB data block and this helps Hadoop to save the HDFS space as the final block is using only that much of space that is needed to store the last part of so therefore we have saved 4mb from being wasted in this scenario now it may seem very little to you that we have only said four MB so what's the big deal but imagine if you are working with tens

of thousands of such files how much data you can save here so this was all about data blocks and how HDFS stores data blocks across different data nodes and I suppose that by now you have understood that why do we need a distributed file system so let me tell you that we have got three advantages when we are using a distributed file system so let me explain this to you with an example so now I imagine that I have got a Hadoop cluster with four machines so one of them is the name node and the other three are data nodes so where the capacity of each of the data node is one terabyte so now let's suppose that I have to store a file of three terabytes so since all my data nodes have a capacity of one terabyte this will be distributed the file of three terabyte will be distributed across my three data nodes and one terabyte will be occupied in each data node so now I don't have to worry about how it is getting stored so

HDFS will manage that and if you see that this provides me with an abstraction of a single computer that is having a capacity of three terabytes so that's the power of HDFS and let me explain you the second benefit of using a distributed file system so now consider that instead of three terabytes I have to store a file of four terabytes and my cluster capacity is only of three terabytes so I'll add one more data node in my cluster in order to fit my requirements and maybe later on when you need to store a file of huge size you can go ahead and add as many machines in your cluster in order to fit all your requirements to store the file so you can see that this kind of file system which is distributed is highly scalable now let me tell you the third benefit of using a distributed file system now let's consider that you have a single high hand computer which has the processing power of processing a one

terabyte data in four seconds now when you're distributing your file across the same single computer with the same capacity are the same processing power you are reading that file parallely so instead of one if you have got four data nodes in your cluster so it will take one bite force of your actual time which we are doing with a single computer so it will take you only one second so basically with the help of distributed file system we are able to distribute our large file across different machines and we're also reducing the processing time by processing it parallely and because of this were able to save huge amount of time in processing the data so this are the benefits of using HDFS and now let us see that how Hadoop can cope up with the data node failure now you know that we are storing our data in data node but what if a data node fails so let us consider the same example over here you

know that I have got to find a 380 MB and I have got three data blocks which are distributed across three data nodes over here in my Hadoop cluster so let's say the data node which contains the last part of the file it crashes what to do that now you have lost a part of your file highly process that file right now because you don't have a part of it so what do you think could be a solution for that so I'm getting an answer so casian says that we should have backup yes exactly so the logical approach to solve this problem would be that we should have multiple copies of the data right and that is how Hadoop was assaulted by introducing something which is known as the replication factor you all know what a replica is replica is nothing but a copy and similarly all our data blocks will also have different copies and in HDFS each of the data block has got three copies across the cluster so you can see that this part of

the file which is 124 MB this data block is present in data node two data node three and data node 4 and similarly this is common to the other data blocks as well so every data block will be there in my Hadoop cluster three times even if one of my data node gets crashed and I lose all of the data blocks that was inside the data node I don't have to worry because there are two more copies present in the other data nodes and we have to that because since in Hadoop we are dealing with commodity hardware's and it is very likely that our commodity hardware will crash at some point of time so that's why we maintain three copies so even if two of them go out we still have got one more so this is how HDFS performs fault tolerance and I have got a question from Neha so she is asking that do we have to go ahead and make replicas of our data blocks well-known Li how you don't have

to do that whenever you put any kind of file when it will copy any file in your Hadoop cluster your files will get replicated by default and by default it will have a replication factor of three it means that every data block will be present automatically three times across your Hadoop cluster so I hope that may have you've got your answer okay so she is saying yes Thank You Niihau for the question that was a very good question indeed so we don't have to worry now if a data node gets crashed we have got multiple copies and since you know the proverb that never put all your eggs in the same basket this is very very true in case of this scenario that we are dealing with right now so we are not putting all our eggs in the same basket we're putting our eggs in three different baskets right now so even if one basket also and all the eggs crack open we don't have to worry we have enough eggs for our omelet if I hope

that you all have understood how HDFS provides fault tolerance if you have any questions you can go ahead and ask me or whenever you get questions you can ask me to this end of this session so now let us understand what happens behind the scene when you are writing a file into the HDFS so when you want to write a file across your Hadoop cluster you have to go through three steps and the first step that you should go through is the pipeline setup so let us understand how to set up a pipeline with an example so let's say that I have got a text file maybe this is called example dot txt and I have divided into two data blocks which is block a and block B so let us talk in terms of block a first let us see how to write block a across my data nodes in my HDFS so here is the client so the client at first request the name note telling that I have got a blog that I need to copy so the name note says okay so I'll

give you the IP address of three data nodes you can copy your file in this three data nodes and you know that you have to copy your block three times because apparently the replication factor is three the name node here gives the IP address of three data nodes data node one four and six to the kingdom so now the client node has caught the IP addresses of three data nodes where block a will be copied so at first what he does he goes and checks two data node 1 and as they don't want that hey I want to copy a block on your data node so are you ready and can you just go and ask data node 4 and 6 if they're ready and the data says yeah I'm ready so I'll just go ahead and ask for m6 so now data node 1 goes to data node 4 and as hey so the kind is asking for you to copy block sorry ready then 4 says yeah I'm ready and then once it's okay just go ahead and have 6 if he is ready also so for us 6 and then 6 is also

ready and this is how the whole pipeline is set up that first block a will be copied to data node 1 then data node 4 and then they denote 6 let's say that in situations there are no data nodes available that whatever IP address the name node gave maybe those are not functioning or those data nodes are not working so in that case when the client node doesn't receive any confirmation he goes back to the main no that says hey whatever IP addresses that you've given those data nodes are not working so would you go and give me another one and then the name node goes on and checks that which are the data nodes are available during that time and give IP address to the client node again so now your pipeline is ready so your pipeline is set up now so first it will be copied onto data node 1 then they tunnel 4 and then data node 6 so this is your pipeline so now comes the second step where the actual writing takes place so

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent