mirror of
https://github.com/linkedin/school-of-sre
synced 2026-01-03 23:28:03 +00:00
371 lines
18 KiB
HTML
371 lines
18 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
||
|
||
|
||
<link rel="shortcut icon" href="../../img/favicon.ico">
|
||
<title>Architecture of Hadoop - school_of_sre</title>
|
||
<link href="../../css/bootstrap-custom.min.css" rel="stylesheet">
|
||
<link href="../../css/font-awesome.min.css" rel="stylesheet">
|
||
<link href="../../css/base.css" rel="stylesheet">
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
|
||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||
<!--[if lt IE 9]>
|
||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||
<![endif]-->
|
||
|
||
<script src="../../js/jquery-1.10.2.min.js" defer></script>
|
||
<script src="../../js/bootstrap-3.0.3.min.js" defer></script>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
||
<script>hljs.initHighlightingOnLoad();</script>
|
||
</head>
|
||
|
||
<body>
|
||
|
||
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||
<div class="container">
|
||
|
||
<!-- Collapsed navigation -->
|
||
<div class="navbar-header">
|
||
<!-- Expander button -->
|
||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||
<span class="sr-only">Toggle navigation</span>
|
||
<span class="icon-bar"></span>
|
||
<span class="icon-bar"></span>
|
||
<span class="icon-bar"></span>
|
||
</button>
|
||
<a class="navbar-brand" href="../..">school_of_sre</a>
|
||
</div>
|
||
|
||
<!-- Expanded navigation -->
|
||
<div class="navbar-collapse collapse">
|
||
<!-- Main navigation -->
|
||
<ul class="nav navbar-nav">
|
||
<li >
|
||
<a href="../..">Home</a>
|
||
</li>
|
||
<li class="dropdown">
|
||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Git <b class="caret"></b></a>
|
||
<ul class="dropdown-menu">
|
||
|
||
<li >
|
||
<a href="../../git/git-basics/">Git Basics</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../git/branches/">Working With Branches</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../git/github-hooks/">Github and Hooks</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="dropdown">
|
||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Python and Web <b class="caret"></b></a>
|
||
<ul class="dropdown-menu">
|
||
|
||
<li >
|
||
<a href="../../python_web/intro/">Intro</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../python_web/python-concepts/">Some Python Concepts</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../python_web/python-web-flask/">Python, Web and Flask</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../python_web/url-shorten-app/">The URL Shortening App</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../python_web/sre-conclusion/">SRE Aspects of The App and Conclusion</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="dropdown">
|
||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Systems Design <b class="caret"></b></a>
|
||
<ul class="dropdown-menu">
|
||
|
||
<li >
|
||
<a href="../../systems_design/intro/">Intro</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../systems_design/scalability/">Scalability</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../systems_design/availability/">Availability</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../systems_design/fault-tolerance/">Fault Tolerance</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../systems_design/conclusion/">Conclusion</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="dropdown active">
|
||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Big Data <b class="caret"></b></a>
|
||
<ul class="dropdown-menu">
|
||
|
||
<li >
|
||
<a href="../intro/">Intro</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../overview/">Overview of Big Data</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../usage/">Usage of Big Data techniques</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../evolution/">Evolution of Hadoop</a>
|
||
</li>
|
||
|
||
<li class="active">
|
||
<a href="./">Architecture of Hadoop</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../tasks/">Tasks and conclusion</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="dropdown">
|
||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Security <b class="caret"></b></a>
|
||
<ul class="dropdown-menu">
|
||
|
||
<li >
|
||
<a href="../../security/intro/">Inro</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../security/fundamentals/">Fundamentals of Security</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../security/network_security/">Network Securuty</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../security/threats_attacks_defences/">Threat, Attacks & Defences</a>
|
||
</li>
|
||
|
||
<li >
|
||
<a href="../../security/writing_secure_code/">Writing Secure code</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<ul class="nav navbar-nav navbar-right">
|
||
<li>
|
||
<a href="#" data-toggle="modal" data-target="#mkdocs_search_modal">
|
||
<i class="fa fa-search"></i> Search
|
||
</a>
|
||
</li>
|
||
<li >
|
||
<a rel="next" href="../evolution/">
|
||
<i class="fa fa-arrow-left"></i> Previous
|
||
</a>
|
||
</li>
|
||
<li >
|
||
<a rel="prev" href="../tasks/">
|
||
Next <i class="fa fa-arrow-right"></i>
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="container">
|
||
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
|
||
<ul class="nav bs-sidenav">
|
||
<li class="main active"><a href="#architecture-of-hadoop">Architecture of Hadoop</a></li>
|
||
<li class="main "><a href="#mapreduce-framework">MapReduce framework</a></li>
|
||
<li class="main "><a href="#other-tooling-around-hadoop">Other tooling around hadoop</a></li>
|
||
<li class="main "><a href="#data-serialisation-and-storage">Data Serialisation and storage</a></li>
|
||
</ul>
|
||
</div></div>
|
||
<div class="col-md-9" role="main">
|
||
|
||
<h1 id="architecture-of-hadoop">Architecture of Hadoop</h1>
|
||
<ol>
|
||
<li>
|
||
<p><strong>HDFS</strong></p>
|
||
<ol>
|
||
<li>The Hadoop Distributed File System (HDFS) is a distributed file system designed to run on commodity hardware. It has many similarities with existing distributed file systems. However, the differences from other distributed file systems are significant. </li>
|
||
<li>HDFS is highly fault-tolerant and is designed to be deployed on low-cost hardware. HDFS provides high throughput access to application data and is suitable for applications that have large data sets. </li>
|
||
<li>HDFS is part of the Apache Hadoop Core project.</li>
|
||
</ol>
|
||
<p><img alt="HDFS Architecture" src="../images/hdfs_architecture.png" /></p>
|
||
<pre><code>1. NameNode: is the arbitrator and central repository of file namespace in the cluster. The NameNode executes the operations such as opening, closing, and renaming files and directories.
|
||
2. DataNode: manages the storage attached to the node on which it runs. It is responsible for serving all the read and write requests. It performs operations on instructions on NameNode such as creation, deletion, and replications of blocks.
|
||
3. Client: Responsible for getting the required metadata from the namenode and then communicating with the datanodes for reads and writes.
|
||
</code></pre>
|
||
</li>
|
||
<li>
|
||
<p><strong>YARN</strong></p>
|
||
<ol>
|
||
<li>YARN stands for “Yet Another Resource Negotiator“. It was introduced in Hadoop 2.0 to remove the bottleneck on Job Tracker which was present in Hadoop 1.0. YARN was described as a “Redesigned Resource Manager” at the time of its launching, but it has now evolved to be known as a large-scale distributed operating system used for Big Data processing.</li>
|
||
<li>The main components of YARN architecture include:</li>
|
||
</ol>
|
||
<p><img alt="YARN Architecture" src="../images/yarn_architecture.gif" /></p>
|
||
<pre><code>1. Client: It submits map-reduce jobs to the resource manager.
|
||
2. Resource Manager: It is the master daemon of YARN and is responsible for resource assignment and management among all the applications. Whenever it receives a processing request, it forwards it to the corresponding node manager and allocates resources for the completion of the request accordingly. It has two major components:
|
||
3. Scheduler: It performs scheduling based on the allocated application and available resources. It is a pure scheduler, which means that it does not perform other tasks such as monitoring or tracking and does not guarantee a restart if a task fails. The YARN scheduler supports plugins such as Capacity Scheduler and Fair Scheduler to partition the cluster resources.
|
||
4. Application manager: It is responsible for accepting the application and negotiating the first container from the resource manager. It also restarts the Application Manager container if a task fails.
|
||
5. Node Manager: It takes care of individual nodes on the Hadoop cluster and manages application and workflow and that particular node. Its primary job is to keep-up with the Node Manager. It monitors resource usage, performs log management and also kills a container based on directions from the resource manager. It is also responsible for creating the container process and starting it on the request of the Application master.
|
||
6. Application Master: An application is a single job submitted to a framework. The application manager is responsible for negotiating resources with the resource manager, tracking the status and monitoring progress of a single application. The application master requests the container from the node manager by sending a Container Launch Context(CLC) which includes everything an application needs to run. Once the application is started, it sends the health report to the resource manager from time-to-time.
|
||
7. Container: It is a collection of physical resources such as RAM, CPU cores and disk on a single node. The containers are invoked by Container Launch Context(CLC) which is a record that contains information such as environment variables, security tokens, dependencies etc.
|
||
</code></pre>
|
||
</li>
|
||
</ol>
|
||
<h1 id="mapreduce-framework">MapReduce framework</h1>
|
||
<p><img alt="MapReduce Framework" src="../images/map_reduce.jpg" /></p>
|
||
<pre><code>1. The term MapReduce represents two separate and distinct tasks Hadoop programs perform-Map Job and Reduce Job. Map jobs take data sets as input and process them to produce key value pairs. Reduce job takes the output of the Map job i.e. the key value pairs and aggregates them to produce desired results.
|
||
2. Hadoop MapReduce (Hadoop Map/Reduce) is a software framework for distributed processing of large data sets on computing clusters. Mapreduce helps to split the input data set into a number of parts and run a program on all data parts parallel at once.
|
||
3. Please find the below Word count example demonstrating the usage of MapReduce framework:
|
||
</code></pre>
|
||
<p><img alt="Word Count Example" src="../images/mapreduce_example.jpg" /></p>
|
||
<h1 id="other-tooling-around-hadoop">Other tooling around hadoop</h1>
|
||
<ol>
|
||
<li><strong>Hive</strong><ol>
|
||
<li>Uses a language called HQL which is very SQL like. Gives non-programmers the ability to query and analyze data in Hadoop. Is basically an abstraction layer on top of map-reduce.</li>
|
||
<li>Ex. HQL query: <ol>
|
||
<li><em>SELECT pet.name, comment FROM pet JOIN event ON (pet.name = event.name);</em></li>
|
||
</ol>
|
||
</li>
|
||
<li>In mysql: <ol>
|
||
<li><em>SELECT pet.name, comment FROM pet, event WHERE pet.name = event.name;</em></li>
|
||
</ol>
|
||
</li>
|
||
</ol>
|
||
</li>
|
||
<li>
|
||
<p><strong>Pig</strong></p>
|
||
<ol>
|
||
<li>Uses a scripting language called Pig Latin, which is more workflow driven. Don't need to be an expert Java programmer but need a few coding skills. Is also an abstraction layer on top of map-reduce.</li>
|
||
<li>Here is a quick question for you:
|
||
What is the output of running the pig queries in the right column against the data present in the left column in the below image?</li>
|
||
</ol>
|
||
<p><img alt="Pig Example" src="../images/pig_example.png" /></p>
|
||
<p>Output:
|
||
<code>mysql
|
||
7,Komal,Nayak,24,9848022334,trivendram
|
||
8,Bharathi,Nambiayar,24,9848022333,Chennai
|
||
5,Trupthi,Mohanthy,23,9848022336,Bhuwaneshwar
|
||
6,Archana,Mishra,23,9848022335,Chennai</code>
|
||
3. <strong>Spark</strong>
|
||
1. Spark provides primitives for in-memory cluster computing that allows user programs to load data into a cluster’s memory and query it repeatedly, making it well suited to machine learning algorithms.
|
||
4. <strong>Presto</strong>
|
||
1. Presto is a high performance, distributed SQL query engine for Big Data.
|
||
2. Its architecture allows users to query a variety of data sources such as Hadoop, AWS S3, Alluxio, MySQL, Cassandra, Kafka, and MongoDB.
|
||
3. Example presto query:
|
||
<code>mysql
|
||
use studentDB;
|
||
show tables;
|
||
SELECT roll_no, name FROM studentDB.studentDetails where section=’A’ limit 5;</code></p>
|
||
</li>
|
||
</ol>
|
||
<h1 id="data-serialisation-and-storage">Data Serialisation and storage</h1>
|
||
<ol>
|
||
<li>In order to transport the data over the network or to store on some persistent storage, we use the process of translating data structures or objects state into binary or textual form. We call this process serialization..</li>
|
||
<li>Avro data is stored in a container file (a .avro file) and its schema (the .avsc file) is stored with the data file.</li>
|
||
<li>Apache Hive provides support to store a table as Avro and can also query data in this serialisation format.</li>
|
||
</ol></div>
|
||
</div>
|
||
|
||
<footer class="col-md-12">
|
||
<hr>
|
||
<p>Documentation built with <a href="https://www.mkdocs.org/">MkDocs</a>.</p>
|
||
</footer>
|
||
<script>
|
||
var base_url = "../..",
|
||
shortcuts = {"search": 83, "next": 78, "help": 191, "previous": 80};
|
||
</script>
|
||
<script src="../../js/base.js" defer></script>
|
||
<script src="../../search/main.js" defer></script>
|
||
|
||
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="Search Modal" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||
<h4 class="modal-title" id="exampleModalLabel">Search</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<p>
|
||
From here you can search these documents. Enter
|
||
your search terms below.
|
||
</p>
|
||
<form role="form">
|
||
<div class="form-group">
|
||
<input type="text" class="form-control" placeholder="Search..." id="mkdocs-search-query" title="Type search term here">
|
||
</div>
|
||
</form>
|
||
<div id="mkdocs-search-results"></div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><div class="modal" id="mkdocs_keyboard_modal" tabindex="-1" role="dialog" aria-labelledby="Keyboard Shortcuts Modal" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||
<h4 class="modal-title" id="exampleModalLabel">Keyboard Shortcuts</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
<th style="width: 20%;">Keys</th>
|
||
<th>Action</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="help shortcut"><kbd>?</kbd></td>
|
||
<td>Open this help</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="next shortcut"><kbd>n</kbd></td>
|
||
<td>Next page</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="prev shortcut"><kbd>p</kbd></td>
|
||
<td>Previous page</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="search shortcut"><kbd>s</kbd></td>
|
||
<td>Search</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="modal-footer">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</body>
|
||
</html>
|