Friday, June 20, 2014

DATA NODE

3.  DATA NODE
-  DATANODES are the workhorse of the HADOOP CLUSTER.
-  All the Data resides on top of DN.
-  DN can read or write a HDFS file (Actually the file is broken into blocks and the Name  Node will tell your client which Data Node each block resides in).
- Upon initialization, each of the Data Nodes informs the Name Node of the blocks it is currently storing.
- After this mapping is complete, the Data Nodes continually poll the Name Node to provide information regarding local changes as well as receive instructions to create, move, or delete blocks from the local disk.
- Your client communicates directly with the Data Node daemons to process the local files corresponding to the blocks.  
- Data Node may communicate with other Data Nodes to replicate its data blocks for redundancy. 
- The Data Nodes provide backup store of the blocks and constantly report to the Name Node to keep the metadata current. 

- Backup store of the blocks ensures that if any one Data Node crashes or becomes inaccessible over the network, you will still be able to read the files.

SECONDARY NAMENODE

2.  SECONDARY NAMENODE
-  SECONDARY NAMENODE will be doing housekeeping activities of NAMENODE.
-  SNN cannot replace the NN in any case of failure.
-  SNN is to perform periodic checkpoints. It will periodically downloads the FSIMAGE and EDITLOG file and merge both of them and keep EDITLOG size with in limit.


-  So if the NN fails we can get a copy of Metadata in the Format of FSIMAGE from SNN.
-  SNN will be coping FSIMAGE from the NN in checkpoint manner.


Thursday, June 19, 2014

NAME NODE (NN)

1.  NAME NODE
-  NAME NODE will act like an MASTER and it will manages the file system namespace. It                                                  maintains the filesystem tree and the metadata for all the files and the directories in the tree.
-  NN will store the METADATA.
- METADATA is the data about physical location of the blocks & by combining which   blocks the data will be prepared.
-  In any case if the NN failed it is called SPOF (single point of failure).
-  The NN will only communicate with clients.
-  The NN is also having capabilities of storing Data in it.
-  NN is very sensitive, even though failures are very rare.

PERSISTANCE FILE SYSTEM in NN

This filesystem metadata is stored in two different constructs: the FSIMAGE and the EDIT LOG.
Ø  FSIMAGE  
Ø  EDITLOG
                                         The fsimage is a file that represents a point-in-time snapshot of the filesystem’s metadata. However, while the fsimage file format is very efficient to read, it’s unsuitable for making small incremental updates like renaming a single file. Thus, rather than writing a new fsimage every time the namespace is modified, the NameNode instead records the modifying operation in the edit log for durability. This way, if the NameNode crashes, it can restore its state by first loading the fsimage then replaying all the operations (also called edits or transactions) in the edit log to catch up to the most recent state of the namesystem. The edit log comprises a series of files, called edit log segments, that together represent all the namesystem modifications made since the creation of the fsimage.             


CHECK POINT MECHANISUM

                 Check pointing is a process that takes an fsimage and edit log and compacts them into a new fsimage. This way, instead of replaying a potentially unbounded edit log, the NameNode can load the final in-memory state directly from the fsimage. This is a far more efficient operation and reduces NameNode startup time.

HADOOP ARCHITECTURE

In our Hadoop Architecture we have 5 Daemons, they are
1.  NAME NODE (NN)
2.  SECONDARY NAME NODE (SNN)
3.  DATA NODE (DN)
4.  JOB TRACKER (JT)
5.  TASK TRACKER (TT)

- In Cloudera Distribution Hadoop (CDH) Mechanism we have Single NAME NODE with the help of SECONDARY NAME NODE.

-  In MAP R Mechanism we can maintain multiple NAME NODES.

Wednesday, June 18, 2014

Hadoop Distributed File System Concepts


Blocks
A disk has a block size, which is the minimum amount of data that it can read or write.
Hadoop also has a concept of a block, minimum block size—64 MB by default.
Files in HDFS are broken into block-sized chunks, which are stored as independent units.
Except the last block remaining all blocks are of equal size.
The Blocks cannot be divided or shared between the files.
Hadoop can process large files efficiently instead of small files.
Block size can also be changed with the help of configurations.
                When we install Hadoop, the Hadoop folder contains some configuration files the Ex: path is /Hadoop/conf/hdfs-site.xml   in this file we have to configure the block size.
<configuration>
<property>
<name>dfs.block.size</name>
<value>141213058</value>
</property>
</configuration>

Replication in HADOOP
Replication is nothing but maintaining same copy of file in another node.
-In our Traditional distributed system, if one node is fail we have to wait until it is recovered or backup is done, till then the result cannot be released.
-But in Hadoop we can get the data from another node as soon as the node fails. It will be possible with the help of replication.
Formula for replication is = n-1  where n = no. of slave nodes
Hadoop is always expecting commodity Software and Hardware.
The default replication factor is “3”, we can also configure using configuration file.
/Hadoop/conf/hdfs-site.xml  in this file we have set the property.
<configuration>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
</configuration>

-If we change the replication factor or block size in configuration file, we have restart the cluster to apply the changes for coming Data.


Tuesday, June 17, 2014

Hadoop Distributed Filesystem

        When a dataset outgrows the storage capacity of a single physical machine, it becomes necessary to partition it across a number of separate machines. Filesystems that manage the storage across a network of machines are called distributed filesystems.
Apache Hadoop is an Open source Distributed system with fault tolerance Mechanism.

Hadoop comes with a distributed filesystem called HDFS, which stands for Hadoop Distributed Filesystem.


Cluster: All the nodes(systems) should be under common dedicated network. Minimum size of Cluster is “1”.
Hadoop Cluster: The Nodes should be appended with both HDFS and MAPREDUCE.
VPN: Virtual private Network.


The Design of HDFS
                            HDFS is a filesystem designed for storing very large files with streaming data access patterns, running on clusters of commodity hardware. Let’s examine this statement in more detail:
Very large files
              “Very large” in this context means files that are hundreds of megabytes, gigabytes, or terabytes in size. There are Hadoop clusters running today that store petabytes of data.
Streaming data access
 HDFS is built around the idea that the most efficient data processing pattern is a write-once, read-many-times pattern. A dataset is typically generated or copied from source, and then various analyses are performed on that dataset over time. Each analysis will involve a large proportion, if not all, of the dataset, so the time to read the whole dataset is more important than the latency in reading the first record.
Commodity hardware
                    Hadoop doesn’t require expensive, highly reliable hardware to run on. It’s designed to run on clusters of commodity hardware (commonly available hardware available from multiple vendors3) for which the chance of node failure across the cluster is high, at least for large clusters. HDFS is designed to carry on working without a noticeable interruption to the user in the face of such failure.
Low-latency data access
                   Applications that require low-latency access to data, in the tens of milliseconds range, will not work well with HDFS. Remember, HDFS is optimized for delivering a high throughput of data, and this may be at the expense of latency. HBase is currently a better choice for low-latency access.
Lots of small files
                    Since the namenode holds filesystem metadata in memory, the limit to the number of files in a filesystem is governed by the amount of memory on the namenode. As a rule of thumb, each file, directory, and block takes about 150 bytes. So, for example, if you had one million files, each taking one block, you would need at least 300 MB of memory. While storing millions of files is feasible, billions is beyond the capability of current hardware.
Write Once read many times
                             Files in HDFS may be written to by a single writer. Writes are always made at the end of the file. There is no support for multiple writers, or for modifications at arbitrary offsets in the file. (These might be supported in the future, but they are likely to be relatively inefficient.)
Moving Business logic near to the Data is easy than moving the Data to the Business logic

                      That means all the computations are moved to the Data rather than moving data near to the Business logic.

A Brief History of Hadoop

Hadoop was created by Doug Cutting, the creator of Apache Lucene, the widely used text search library. Hadoop has its origins in Apache Nutch, an open source web search engine, itself a part of the Lucene project.
          The project’s creator, Doug Cutting, explains how the name came about:
The name my kid gave a stuffed yellow elephant. Short, relatively easy to spell and pronounce, meaningless, and not used elsewhere: those are my naming criteria. Kids are good at generating such. Googol is a kid’s term.

            In January 2008, Hadoop was made its own top-level project at Apache, confirming its success and its diverse, active community. By this time, Hadoop was being used by many other companies besides Yahoo!, such as Last.fm, Facebook. In April 2008, Hadoop broke a world record to become the fastest system to sort a terabyte of data. Running on a 910-node cluster, Hadoop sorted one terabyte in 209 seconds (just under 3½ minutes).

• 2004—Initial versions of what is now Hadoop Distributed Filesystem and Map-Reduce implemented by Doug Cutting and Mike Cafarella.
• December 2005—Nutch ported to the new framework. Hadoop runs reliably on 20 nodes.
• January 2006—Doug Cutting joins Yahoo!.
• February 2006—Apache Hadoop project officially started to support the standalone
development of MapReduce and HDFS.
• February 2006—Adoption of Hadoop by Yahoo! Grid team.
• April 2006—Sort benchmark (10 GB/node) run on 188 nodes in 47.9 hours.
• May 2006—Yahoo! set up a Hadoop research cluster—300 nodes.
• May 2006—Sort benchmark run on 500 nodes in 42 hours (better hardware than April benchmark).
• October 2006—Research cluster reaches 600 nodes.
• December 2006—Sort benchmark run on 20 nodes in 1.8 hours, 100 nodes in 3.3hours, 500 nodes in 5.2 hours, 900 nodes in 7.8 hours.
• January 2007—Research cluster reaches 900 nodes.
• April 2007—Research clusters—2 clusters of 1000 nodes.
• April 2008—Won the 1 terabyte sort benchmark in 209 seconds on 900 nodes.
• October 2008—Loading 10 terabytes of data per day on to research clusters.
• March 2009—17 clusters with a total of 24,000 nodes.

• April 2009—Won the minute sort by sorting 500 GB in 59 seconds (on 1,400 nodes) and the 100 terabyte sort in 173 minutes (on 3,400 nodes).