I hope everyone is aware of archaeological periods (like stone age,bronze age,iron age and now historical periods). But scientists feels like we live in “Data age”now. Its not so easy to measure digital universe, IDC estimates 1.8 Zettabytes(10^21 bytes which is equal to 1 Billion TeraBytes) of data in 2011. Sources: http://www.emc.com/leadership/programs/digital-universe.htm
Flood of data is coming from many sources like
- FB hosts approximately 10 billion photos taking up 1 PB of storage
- BSE sensex generates 1TB/day..flight simulator generates the same for each trip it travels..all your footprints are tracked digitally by machinelogs, RFID readers, GPS etc etc
- Your day to day life individuals interactions like phone calls, emails, documents, transactions etc..all to be saved somewhere crucially.
How to organize this huge volume of data without any loss?? How the company use this data for analysis like transaction analytics, claim fraud analytics, surveillance analytics etc ?? How safe can we keep all data in a single drive/cluster ?? what happens when it crashes?? How about processing this huge data from a drive?? Performance ??
All can be overcome easily..How??
Specifically, Big Data relates to data creation, storage, retrieval and analysis that is remarkable in terms of volume, velocity, and variety (3 V’s)
What is 3V?
- Volume(Huge volume)
- Variety(Diff kinds of data(structured,semi structured and unstructured))
3.Velocity(Speed,performance,real time streaming,batch processing)
How to operate BIG DATA??
Here comes Hadoop- a software framework written by Doug Cutting in java language.
Hadoop is a software framework for distributed processing of large datasets across large clusters of computers.
Origin of name Hadoop: The name Hadoop is not an acronym; it’s a madeup name. Doug named it by his kid toy(elephant) name. His kid use to call up that toy as “Hadoop”.
Major benefit: In application layer itself it process everything and finally gives result through network. This means smooth and fast processing. Hadoop reads 64MB file at once where as normal file system in windows/linux os only reads 4KB at a time.
Digging deeper into Hadoop:
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.
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
MapReduce is a parallel programming model that is used to retrieve the data from the Hadoop cluster
- In this model, 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 retrieving required data from a huge dataset in a fast manner.
- Programmers 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. If any one of those jobs fails, it reallocates the job to another node, etc.
- TaskTracker performs the map and reduce tasks that are assigned by the JobTracker.
Map and Reduce Example
MapReduce works by breaking the processing into two phases: the map phase and the
reduce phase. Each phase has key-value pairs as input and output, the types of which
may be chosen by the programmer. The programmer also specifies two functions: the
map function and the reduce function.
The input to our map phase is the raw NCDC data.
Our map function is simple. We pull out the year and the air temperature, since these
are the only fields we are interested in.
To visualize the way the map works, consider the following sample lines of input data.
These lines are presented to the map function as the key-value pairs:
The map function merely extracts the year and the air temperature (indicated in bold text),
and emits them as its output.
This processing sorts and groups the key-value pairs by key.
(1949, [111, 78])
(1950, [0, 22, −11])
All the reduce function
has to do now is iterate through the list and pick up the maximum reading:
This is the final output: the maximum global temperature recorded in each year.
Hadoop eco-system tools:
- Pig (programming tool for creating MapReduce programs used with Hadoop)
- Hive(data warehouse infrastructure built on top of Hadoop for providing data summarization, query, and analysis)
- Hbase(HBase is an open source, non-relational, distributed database runs on top of HDFS)
- Zookeeper(an open source distributed configuration service,synchronization service and naming registry for large distributed systems. ZooKeeper’s architecture supports high-availability through redundant services.)
- Avro (Avro is a remote procedure call and serialization framework which means communication between Hadoop nodes, and from client programs to the Hadoop services.)
- Sqoop(Sqoop is a tool designed for efficiently transferring bulk data between Apache Hadoop and structured datastores such as relational databases)