DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Big Data
  4. Hadoop Revisited, Part I: Tutorial and Cheat Sheet

Hadoop Revisited, Part I: Tutorial and Cheat Sheet

It's time to get back to the basics and review the main key concepts of Hadoop so that we have a solid foundation when working with it.

Tomer Ben David user avatar by
Tomer Ben David
·
Apr. 14, 17 · Tutorial
Like (16)
Save
Tweet
Share
105.68K Views

Join the DZone community and get the full member experience.

Join For Free

In this series, we are going to scan through some Hadoop main concepts. Hadoop is a well-known platform, and we are not going to "rediscover" it here. However, we are going to review its key concepts. After being stormed by so many platforms (i.e. Storm, Spark, and Kafka), it's time to get back to the basics and review so that we have a solid ground on Hadoop key concepts.

Our plan:

  1. Name the basic key concepts.

  2. Scan Hadoop job management main concepts, again focusing on the few most important concepts.

  3. Learn the three most-used Hadoop fs commands and see how to use them.

1. Basic Key Concepts

Every mapper communicates with all reducers (potentially sending data to all of them). Here are some key terms to help you:

  • Shuffle: Communication from mappers to reducers.
  • Block Size: Files (of any and every size) are split into blocks.
    • If you want your result to reside in a single file (can't be multiple blocks) you need a single reducer.
  • Partitioner: Splits the map result to the reducer the with hash so that the same keys always reach the same reducers.

Lastly, in order to edit Hadoop configurations, all you need to do is access the configurations in the folder /etc/hadoop/conf.

2. Hadoop Job Management

A core concept of Hadoop is its famous job management. Here are the main things to remember about it:

  • The master sends the actual jar to be executed to data nodes.
  • Hadoop sends data from mappers to reducers even before mappers finish in order to have reducers ready to start working.
  • hadoop jar is the command that will run your jar.
    • You should have already uploaded it to the Hadoop cluster with -put.
  • Show a list of running jobs with mapred job -list.

Step 3: Hadoop Main Commands

Here are the most commonly used commands in Hadoop and their usages. (I have chosen the top three commands that I use.)

  1. hadoop fs -cat. Usage: hadoop fs -cat URI [URI...]. Copies source path to stdout. We print to console a file and grep search for a string. You can combine this with other bash command lines like wc -l to count the number of lines containing these results. 
  2. $ hadoop fs -cat hdfs://myhadoop/file0000 | grep "somestring i search for"
  3. hadoop fs -get. With this command, we get a remote file to a local file system. The below commands fetch from user/hadoop/filee in your local file system for a file named localfile and a remote file named file. 

  4. hadoop fs -get /user/hadoop/file localfile
    hadoop fs -get hdfs://nn.example.com/user/hadoop/file localfile
  5. hadoop fs -ls. This is simply the ls Hadoop file system with very similar arguments to the bash one. The main option is -R, which recursively lists all subdirectories encountered. ls returns the stats on the file with the following format:
  6. # list all files under /myuser/hadoop/
    hadoop fs -ls /myuser/hadoop/

Summary

In this first post, we have scanned Hadoop main concepts, job management, and main command line utils. In the next post, we are going to write our first map reduce job while also looking at its key concepts to build a solid ground. See ya there!

hadoop Concept (generic programming) File system Command (computing)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top 5 Node.js REST API Frameworks
  • 5 Factors When Selecting a Database
  • Iptables Basic Commands for Novice
  • OpenID Connect Flows

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: