02_Introduction to Hadoop (1).pptx
Document Details
Uploaded by GainfulBromine
Yarmouk University
Tags
Full Transcript
Yarmouk University Faculty of Information Technology and Computer Sciences Big Data Management Topic 1: Introduction and Hadoop Acknowledgements: Most of these slides have been prepared by Dr. Jure Leskovec, Stanford University, and Dr....
Yarmouk University Faculty of Information Technology and Computer Sciences Big Data Management Topic 1: Introduction and Hadoop Acknowledgements: Most of these slides have been prepared by Dr. Jure Leskovec, Stanford University, and Dr. Xin Cao, University of New South Wales and adopted for our course. Additional slides have been added from the mentioned references in the syllabus What is Hadoop Open-source data storage and processing platform Before the advent of Hadoop, storage and processing of big data was a big challenge Massively scalable, automatically parallelizable Based on work from Google Google: GFS + MapReduce + BigTable (Not open) Hadoop: HDFS + Hadoop MapReduce + HBase ( opensource) Named by Doug Cutting in 2006 (worked at Yahoo! at that time), after his son's toy elephant. 2 Hadoop offers Redundant, Fault-tolerant data storage Parallel computation framework Q: Where file is Job coordination located? No longer need to worry about Q: How to handle failures & data lost? Q: How to divide computation? Programmers Q: How to program for scaling? 3 Why Use Hadoop? Cheaper Scales to Petabytes or more easily Faster Parallel data processing Better Suited for particular types of big data problems 4 Companies Using Hadoop 5 Forecast growth of Hadoop Job Market 6 Hadoop is a set of Apache Frameworks and more… HDFS: HDFS is the primary or major component of Hadoop ecosystem and is responsible for storing large data sets of structured or unstructured data across various nodes and thereby maintaining the metadata in the form of log files. 7 Hadoop is a set of Apache Frameworks and more… Apache HBase: It’s a NoSQL database which supports all kinds of data and thus capable of handling anything of Hadoop Database. It provides capabilities of Google’s BigTable, thus able to work on Big Data sets effectively. 8 Hadoop is a set of Apache Frameworks and more… MapReduce: By making the use of distributed and parallel algorithms, MapReduce makes it possible to carry over the processing’s logic and helps to write applications which transform big data sets into a manageable one. MapReduce makes the use of two functions i.e. Map() and Reduce() whose task is: Map() performs sorting and filtering of data and thereby organizing them in the form of groups. Map generates a key-value pair based result which is later on processed by the Reduce() method. Reduce() as the name suggests does the summarization by aggregating the mapped data. In simple, Reduce() takes the output generated by Map() as input and combines those tuples into smaller set of tuples. 9 Hadoop is a set of Apache Frameworks and more… YARN: Yet Another Resource Negotiator, as the name implies, YARN is the one who helps to manage the resources across the clusters. In short, it performs scheduling and resource allocation for the Hadoop System. Consists of three major components i.e. Resource Manager Nodes Manager Application Manager 10 Hadoop is a set of Apache Frameworks and more… HIVE: With the help of SQL methodology and interface, HIVE performs reading and writing of large data sets. However, its query language is called as HQL (Hive Query Language). It is highly scalable as it allows real-time processing and batch processing both. Also, all the SQL datatypes are supported by Hive thus, making the query processing easier. 11 Hadoop is a set of Apache Frameworks and more… PIG: Pig was basically developed by Yahoo which works on a pig Latin language, which is Query based language similar to SQL. It is a platform for structuring the data flow, processing and analyzing huge data sets. Pig does the work of executing commands and in the background, all the activities of MapReduce are taken care of. After the processing, pig stores the result in HDFS. 12 Hadoop is a set of Apache Frameworks and more… Mahout: Mahout, allows Machine Learnability to a system or application. Machine Learning, as the name suggests helps the system to develop itself based on some patterns, user/environmental interaction or on the basis of algorithms. It provides various libraries or functionalities such as collaborative filtering, clustering, and classification which are nothing but concepts of Machine learning. It allows invoking algorithms as per our need with the help of its own libraries. 13 Hadoop is a set of Apache Frameworks and more… Avro Avro stores the data definition in JSON format making it easy to read and interpret; the data itself is stored in binary format making it compact and efficient. Avro files include markers that can be used to split large data sets into subsets suitable for Apache MapReduce processing. Sqoop is a command-line interface application for transferring data between relational databases and Hadoop 14 Hadoop is a set of Apache Frameworks and more… Zookeeper: There was a huge issue of management of coordination and synchronization among the resources or the components of Hadoop which resulted in inconsistency, often. Zookeeper overcame all the problems by performing synchronization, inter-component based communication, grouping, and maintenance. Oozie: Oozie simply performs the task of a scheduler, thus scheduling jobs and binding them together as a single unit. There is two kinds of jobs.i.e Oozie workflow and Oozie coordinator jobs. Oozie workflow is the jobs that need to be executed in a sequentially ordered manner whereas Oozie Coordinator jobs are those that are triggered when some data or external stimulus is given to it. 15 What are the core parts of a Hadoop distribution? HDFS Storage Redundant (3 copies) MapReduce API Other For large files – large blocks Batch (Job) Libraries processing 64 or 128 MB / block Pig Distributed and Can scale to 1000s of Localized to clusters Hive nodes (Map) HBase Auto-Parallelizable for Others huge amounts of data Fault-tolerant (auto retries) Adds high availability and more 16 Hadoop 2.0 Single Use System Multi-Purpose Platform Batch apps Batch, Interactive, Online, Streaming In Hadoop 1, there is HDFS which is used for storage and top of it, Map Reduce which works as Resource Management as well as Data Processing. Due to this workload on Map Reduce, it will affect the performance. In Hadoop 2, there is again HDFS which is again used for storage and on the top of HDFS, there is YARN which works as Resource 17 Hadoop 2.0 Hadoop 1 is a Master-Slave architecture. It consists of a single master and multiple slaves. Suppose if master node got crashed then irrespective of your best slave nodes, your cluster will be destroyed. Hadoop 2 is also a Master-Slave architecture. But this consists of multiple masters and multiple slaves. If here master node got crashed then standby master node will take over it. You can make multiple combinations of active-standby nodes. Thus Hadoop 2 will18 Common Hadoop Distributions Open Source Apache Commercial Cloudera Hortonworks MapR AWS MapReduce Microsoft Azure HDInsight (Beta) 19 Comparing: RDBMS vs. Hadoop Traditional RDBMS Hadoop / MapReduce Data Size Gigabytes (Terabytes) Petabytes (Exabytes) Access Interactive and Batch Batch – NOT Interactive (v1.0) Batch, Interactive, streaming, real-time (v2.0) Updates Read / Write many times Write once, Read many times Structure Static Schema Dynamic Schema Integrity High Low Query Can be near immediate Has latency (due to batch Response processing) Time 20 The Changing Data Management Landscape 21 Spark (Red) vs Hadoop interest overtime 22 Philosophy to Scale for Big Data Processing Divide Work Combine Results 23 Large-scale Computing Large-scale computing problems on commodity hardware: Challenges: How do you distribute computation? How can we make it easy to write distributed programs? Machines fail: One server may stay up 3 years (1,000 days) If you have 1,000 servers, expect to loose 1/day With 1M machines 1,000 machines fail every day! 24 An Idea and a Solution Issue: Copying data over a network takes time Idea: Bring computation to data Store files multiple times for reliability Spark/Hadoop address these problems Storage Infrastructure – File system Google: GFS. Hadoop: HDFS Programming model MapReduce Spark 25 Storage Infrastructure Problem: If nodes fail, how to store data persistently? Answer: Distributed File System Provides global file namespace Typical usage pattern: Huge files (100s of GB to TB) Data is rarely updated in place Reads and appends are common 26 Distributed File System Chunk servers File is split into contiguous chunks Typically each chunk is 64-128MB Each chunk replicated (usually 2x or 3x) Try to keep replicas in different racks Master node a.k.a. Name Node in Hadoop’s HDFS Stores metadata about where files are stored Might be replicated Client library for file access Talks to master to find chunk servers Connects directly to chunk servers to access data 27 Distributed File System Reliable distributed file system Data kept in “chunks” spread across machines Each chunk replicated on different machines Seamless recovery from disk or machine failure C0 C1 D0 C1 C2 C5 C0 C5 C5 C2 C5 C3 D0 D1 … D0 C2 Chunk server 1 Chunk server 2 Chunk server 3 Chunk server N Bring computation directly to the data! Chunk servers also serve as compute servers 28 Programming Model MapReduce is a style of programming designed for: 1. Easy parallel programming 2. Invisible management of hardware and software failures 3. Easy management of very-large-scale data Ithas several implementations, including Hadoop, Spark (used in this class), Flink, and the original Google implementation just called “MapReduce” 29 MapReduce: Overview 3 steps of MapReduce Map: Apply a user-written Map function to each input element Mapper applies the Map function to a single element Many mappers grouped in a Map task (the unit of parallelism) The output of the Map function is a set of 0, 1, or more key-value pairs. Group by key: Sort and shuffle System sorts all the key-value pairs by key, and outputs key-(list of values) pairs Reduce: User-written Reduce function is applied to each key-(list of values) Outline stays the same, Map and Reduce change to fit the problem 30 Map-Reduce: A diagram MAP: Read input and produces a set of key-value pairs Group by key: Collect all pairs with same key (Hash merge, Shuffle, Sort, Partition) Reduce: Collect all values belonging to the key and output 31 Example: Word Counting Example MapReduce task: We have a huge text document Count the number of times each distinct word appears in the file Many applications of this: Analyze web server logs to find popular URLs Statistical machine translation: Need to count number of times every 5-word sequence occurs in a large corpus of documents 32 MapReduce Example 1 – Word Count Hadoop MapReduce is an implementation of MapReduce MapReduce is a computing paradigm (Google) Hadoop MapReduce is an open-source software 33 MapReduce Example 2 – Scores Count 34 MapReduce Example 2 – Scores Count 35 MapReduce: Environment MapReduce environment takes care of: Partitioning the input data Scheduling the program’s execution across a set of machines Performing the group by key step In practice this is is the bottleneck Handlingmachine failures Managing required inter-machine communication 36 Too many frameworks in H ES 37 THE END 38