Hadoop is an open source software used for distributed computing that can be used to query a large set of data and get the results faster using reliable and scalable architecture.
This is the first article in our new ongoing Hadoop series.
In a traditional non distributed architecture, you’ll have data stored in one server and any client program will access this central data server to retrieve the data. The non distributed model has few fundamental issues. In this model, you’ll mostly scale vertically by adding more CPU, adding more storage, etc. This architecture is also not reliable, as if the main server fails, you have to go back to the backup to restore the data. From performance point of view, this architecture will not provide the results faster when you are running a query against a huge data set.
In a traditional non distributed architecture, you’ll have data stored in one server and any client program will access this central data server to retrieve the data. The non distributed model has few fundamental issues. In this model, you’ll mostly scale vertically by adding more CPU, adding more storage, etc. This architecture is also not reliable, as if the main server fails, you have to go back to the backup to restore the data. From performance point of view, this architecture will not provide the results faster when you are running a query against a huge data set.
In a hadoop distributed architecture, both data and processing are distributed across multiple servers. The following are some of the key points to remember about the hadoop:
- Each and every server offers local computation and storage. i.e When you run a query against a large data set, every server in this distributed architecture will be executing the query on its local machine against the local data set. Finally, the resultset from all this local servers are consolidated.
- In simple terms, instead of running a query on a single server, the query is split across multiple servers, and the results are consolidated. This means that the results of a query on a larger dataset are returned faster.
- You don’t need a powerful server. Just use several less expensive commodity servers as hadoop individual nodes.
- High fault-tolerance. If any of the nodes fails in the hadoop environment, it will still return the dataset properly, as hadoop takes care of replicating and distributing the data efficiently across the multiple nodes.
- A simple hadoop implementation can use just two servers. But you can scale up to several thousands of servers without any additional effort.
- Hadoop is written in Java. So, it can run on any platform.
- Please keep in mind that hadoop is not a replacement for your RDBMS. You’ll typically use hadoop for unstructured data
- Originally Google started using the distributed computing model based on GFS (Google Filesystem) and MapReduce. Later Nutch (open source web search software) was rewritten using MapReduce. Hadoop was branced out of Nutch as a separate project. NowHadoop is a top-level Apache project that has gained tremendous momentum and popularity in recent years.
HDFS
HDFS stands for Hadoop Distributed File System, which is the storage system used by Hadoop. The following is a high-level architecture that explains how HDFS works.
The following are some of the key points to remember about the HDFS:
- In the above diagram, there is one NameNode, and multiple DataNodes (servers). b1, b2, indicates data blocks.
- When you dump a file (or data) into the HDFS, it stores them in blocks on the various nodes in the hadoop cluster. HDFS creates several replication of the data blocks and distributes them accordingly in the cluster in way that will be reliable and can be retrieved faster. A typical HDFS block size is 128MB. Each and every data block is replicated to multiple nodes across the cluster.
- Hadoop will internally make sure that any node failure will never results in a data loss.
- There will be one NameNode that manages the file system metadata
- There will be multiple DataNodes (These are the real cheap commodity servers) that will store the data blocks
- When you execute a query from a client, it will reach out to the NameNode to get the file metadata information, and then it will reach out to the DataNodes to get the real data blocks
- Hadoop provides a command line interface for administrators to work on HDFS
- The NameNode comes with an in-built web server from where you can browse the HDFS filesystem and view some basic cluster statistics
MapReduce
The following are some of the key points to remember about the HDFS:
MapReduce is a parallel programming model that is used to retrieve the data from the Hadoop cluster- In this model, the library handles lot of messy details that programmers doesn’t need to worry about. For example, the library takes care of parallelization, fault tolerance, data distribution, load balancing, etc.
- This splits the tasks and executes on the various nodes parallely, thus speeding up the computation and retriving required data from a huge dataset in a fast manner.
- This provides a clear abstraction for programmers. They have to just implement (or use) two functions: map and reduce
- The data are fed into the map function as key value pairs to produce intermediate key/value pairs
- Once the mapping is done, all the intermediate results from various nodes are reduced to create the final output
- JobTracker keeps track of all the MapReduces jobs that are running on various nodes. This schedules the jobs, keeps track of all the map and reduce jobs running across the nodes. If any one of those jobs fails, it reallocates the job to another node, etc. In simple terms, JobTracker is responsible for making sure that the query on a huge dataset runs successfully and the data is returned to the client in a reliable manner.
- TaskTracker performs the map and reduce tasks that are assigned by the JobTracker. TaskTracker also constantly sends a hearbeat message to JobTracker, which helps JobTracker to decide whether to delegate a new task to this particular node or not.
We’ve only scratched the surface of the Hadoop. This is just the first article in our ongoing series on Hadoop. In the future articles of this series, we’ll explain how to install and configure Hadoop environment, and how to write MapReduce programs to retrieve the data from the cluster, and how to effectively maintain a Hadoop infrastructure.