Hadoop Overview


Hadoop Overview

Anna
So, Corey, have you ever wondered why we hear so much about big data and Hadoop these days? It's all about the massive amounts of data being generated every second.

Corey
Yeah, I've seen the stats – like millions of likes on Facebook and hours of video uploaded to YouTube every minute. But what exactly makes that data 'big' and why can't traditional systems handle it?

Anna
Great question! The growth drivers are things like smartphones, social media, and the Internet of Things. Cisco predicted that by 2020 we'd be dealing with over 30 exabytes of data per month. That's a 10 with 18 zeros – huge! Traditional systems just weren't built for that scale.

Corey
So how do we define a big data problem? I've heard of the five V's – volume, variety, velocity, value, and veracity. Can you explain those?

Anna
Exactly! Volume is the sheer size of data. Variety means data comes in many forms – structured like databases, semi-structured like JSON, and unstructured like videos, which is about 90% of data. Velocity is the speed at which data streams in – think sensors generating millions of events per second.

Corey
And value and veracity? I imagine value is about extracting useful insights, and veracity deals with trustworthiness?

Anna
Right on! Value means the data must be meaningful – if you can't derive business insights, it's just noise. Veracity refers to the quality and reliability of data – it can be messy, incomplete, or inconsistent. These five V's help identify if you actually have a big data problem.

Corey
Okay, so once we identify it, what's the solution? That's where Hadoop comes in, right?

Anna
Yes! Apache Hadoop is a framework that allows distributed storage and processing of large datasets across clusters of commodity hardware. Think of it like a restaurant kitchen where one chef can't handle ten orders per hour, but if you hire multiple chefs and give each their own ingredients, you can scale.

Corey
I like the analogy! So the storage part is HDFS – Hadoop Distributed File System. How does that work?

Anna
HDFS has a master/slave architecture. The master is the NameNode, which manages metadata and tracks where data is stored. The slaves are DataNodes that actually store the data. Files are split into blocks – default size is 128 MB – and each block is replicated three times across different DataNodes for fault tolerance.

Corey
What about the Secondary NameNode? Is that a backup for the NameNode?

Anna
Actually, it's not a failover node. It periodically combines the edit log (recent changes) with the FS image (full metadata) through a process called checkpointing. This prevents the edit log from growing too large and helps with faster recovery if the NameNode fails.

Corey
Got it. And the processing part is MapReduce. That's the framework for writing parallel programs, right?

Anna
Exactly. MapReduce has two phases: Map and Reduce. In the Map phase, each DataNode processes a chunk of data and produces intermediate key-value pairs. Then the Reduce phase aggregates those pairs to produce the final output. A classic example is word count – each mapper counts words in its piece, then reducers sum up the counts.

Corey
So you write a mapper class, a reducer class, and a driver that sets up the job. That's the typical Java code structure, right?

Anna
Yes! The mapper takes input as key-value pairs (like byte offset and line of text), splits it into words, and emits each word with a count of 1. The reducer receives all counts for a word and sums them. The driver specifies the input/output paths and class names.

Corey
I've also heard about YARN. What's its role?

Anna
YARN stands for Yet Another Resource Negotiator – it's the resource management layer of Hadoop. It has a ResourceManager (master) and NodeManagers on each slave. When a job is submitted, the ResourceManager launches an ApplicationMaster that negotiates containers (CPU + memory) to run Map and Reduce tasks.

Corey
And then there's the whole Hadoop ecosystem – tools like Hive, Pig, Spark, etc. Can you give a quick overview?

Anna
Sure! Hive allows SQL-like queries on Hadoop data, Pig is a scripting language that compiles into MapReduce – one line of Pig can replace 200 lines of Java. Flume and Sqoop handle data ingestion, Spark does in-memory processing, and there are tools for machine learning, coordination, and workflow management.

Corey
That's a lot! But it makes sense – you pick the right tool for the job. I heard you can also run a use case with Olympics data using Pig. How does that work?

Anna
We loaded an Olympic athlete dataset into HDFS, then used Pig to find the top 10 countries by total medals. The commands are like LOAD, GROUP, COUNT, and ORDER. Each Pig statement gets translated into a MapReduce job automatically. You can also filter by sport – like swimming – to see which countries excel.

Corey
So you just write a few lines of Pig Latin, and it does the heavy lifting? That's powerful!

Anna
Absolutely! That's the beauty of Hadoop – it handles distribution and fault tolerance under the hood. You focus on the logic, and it scales. Whether you're processing terabytes or petabytes, the principles are the same.

Corey
Thanks, Anna! Now I have a much clearer picture of big data and Hadoop. It's not just a buzzword – it's a practical solution for real-world data challenges.

Anna
You're welcome! And remember, Hadoop works best in a multi-node cluster. For learning, you can set up a pseudo-distributed mode, but production needs real distribution. Happy learning!

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