What are the Hadoop MapReduce concepts?

What do you mean by Map-Reduce programming?

MapReduce is a programming model designed for processing large volumes of data in parallel by dividing the work into a set of independent tasks.

The MapReduce programming model is inspired by functional languages and targets data-intensive computations. The input data format is application-specific, and is specified by the user. The output is a set of <key,değer> pairs. The user expresses an algorithm using two functions, Map and Reduce. The Map function is applied on the input data and produces a list of intermediate <key,değer> pairs. The Reduce function is applied to all intermediate pairs with the same key. It typically performs some kind of merging operation and produces zero or more output pairs. Finally, çıkış çiftleri kendi anahtar değerine göre sıralanır. MapReduce programları basit formunda, programcı sadece Harita fonksiyonu sağlar. Diğer işlevsellik, Aynı anahtar ve nihai sıralama var ara çiftlerinin gruplama dahil, çalışma zamanı tarafından sağlanan.

MapReduce modelinin Aşama

MapReduce işin üst düzey birimi bir iş. Bir iş genellikle bir harita vardır ve bir faz azaltmak, azaltmak faz atlanabilir rağmen. For example, Her kelime belgeleri bir dizi genelinde kullanılan sayısını sayar bir MapReduce işi düşünün. Harita aşaması her belgede sözcükleri sayar, Sonra faz tüm koleksiyonu kapsayan kelime sayıları içine başına belge verilerini toplayan azaltmak.

harita aşamasında, the input data is divided into input splits for analysis by map tasks running in parallel across the Hadoop cluster. By default, the MapReduce framework gets input data from the Hadoop Distributed File System (HDFS).

The reduce phase uses results from map tasks as input to a set of parallel reduce tasks. The reduce tasks consolidate the data into final results. By default, the MapReduce framework stores results in HDFS.

Although the reduce phase depends on output from the map phase, map and reduce processing is not necessarily sequential. That is, reduce tasks can begin as soon as any map task completes. It is not necessary for all map tasks to complete before any reduce task can begin.

MapReduce operates on key-value pairs. Conceptually, a MapReduce job takes a set of input key-value pairs and produces a set of output key-value pairs by passing the data through map and reduces functions. The map tasks produce an intermediate set of key-value pairs that the reduce tasks uses as input.

The keys in the map output pairs need not be unique. Between the map processing and the reduce processing, a shuffle step sorts all map output values with the same key into a single reduce input (key, value-list) pair, where the ‘value’ is a list of all values sharing the same key. Thus, the input to a reduce task is actually a set of (key, value-list) pairs.

Though each set of key-value pairs is homogeneous, the key-value pairs in each step need not have the same type. For example, the key-value pairs in the input set (KV1) can be (string, string) pairs, with the map phase producing (string, integer) ara sonuçları olarak çiftleri (KV2), ve faz üreten azaltmak (integer, string) Nihai sonuçlar için çiftleri (KV3).

The keys in the map output pairs need not be unique. Between the map processing and the reduce processing, a shuffle step sorts all map output values with the same key into a single reduce input (key, value-list) pair, where the ‘value’ is a list of all values sharing the same key. Thus, the input to a reduce task is actually a set of (key, value-list) pairs.

Örnek gösteren MapReduce kavramları

örnek metin dosyaları bir dizi her kelimenin geçtiği sayısını hesaplayarak temel MapReduce kavramını gösterir.

MapReduce giriş veri girişi böler ayrılmıştır, ve bölünmeler daha da girdi anahtar-değer çiftleri ayrılır. Bu örnekte, Giriş veri seti iki belge olduğunu, document1 ve document2. InputFormat alt sınıf veri belgesi başına bir bölünme içine koymak bölen, toplam 2 bölünmeler:

Note: MapReduce çerçeve iş yapılandırmasında verilen org.apache.hadoop.mapreduce.InputFormat alt sınıf kullanarak topakları denilen böler içine yerleştirilen giriş verileri böler. Böler Job Tracker kullanımına iş bilgileri yerel iş Müşteri tarafından oluşturulan ve dahildir. JobTracker her bölünme için bir harita görev oluşturur. Her harita görev girişi anahtar-değer çiftleri içine bölünmüş dönüştürmek için InputFormat alt sınıf tarafından sağlanan bir RecordReader kullanır.

A (satır numarası, text) anahtar-değer çifti bir giriş belgesinde her bir hat için oluşturulan. harita işlevi satır numarasını atar ve başına satır üretir (sözcük, ortak) giriş satırında her kelime için çift. Faz üretir azaltmak (sözcük, ortak) Tüm giriş belgeleri arasında toplu kelime sayısı temsil çiftleri. örnek iş için harita azaltmak ilerleme göstermiştir giriş verileri göz önüne alındığında:

Harita aşamasından çıktı aynı anahtarla birden anahtar-değer çiftlerini içeren: 'yulaf’ ve ye’ tuşlarına iki kere görünür. Recall that the MapReduce framework consolidates all values with the same key before entering the reduce phase, so the input to reduce is actually (key, values) pairs. Therefore, the full progression from map output, through reduce, to final results is shown above.

MapReduce Job Life Cycle

Following is the life cycle of a typical MapReduce job and the roles of the primary actors.The full life cycle are more complex so here we will concentrate on the primary components.

The Hadoop configuration can be done in different ways but the basic configuration consists of the following.

  • Single master node running Job Tracker
  • Multiple worker nodes running Task Tracker

Following are the life cycle components of MapReduce job.

  • Local Job client: yerel iş Müşteri teslimi için iş hazırlar ve İş Tracker kapalı eller.
  • iş Tracker: İş Tracker programları iş ve paralel işleme Görev İzleyici arasında harita çalışması dağıtır.
  • görev Tracker: Her Görev Tracker Harita Görevi çoğaltılır. İş Tracker Görev İzleyici İlerleme bilgi alır.

harita sonuçları mevcuttur kez, İş Tracker paralel işleme Görev İzleyici arasında azaltmak işi dağıtır.

Her Görev Tracker bir işi gerçekleştirmek için Görevi azaltın çoğaltılır. İş Tracker Görev İzleyici İlerleme bilgi alır.

Tüm harita görevleri önce tamamlamak görevler yayınlanmaya başlaması azaltmak zorunda değilsiniz. harita görevleri tamamlayarak başladıkça azaltmak görevleri en kısa sürede başlayabilir. Thus, harita ve adımlar genellikle örtüşüyor azaltmak.

MapReduce iş farklı bileşenlerin İşlevsellik

iş Müşteri: İş istemci aşağıdaki görevleri gerçekleştirir

  • Validates the job configuration
  • Generates the input splits. This is basically splitting the input job into chunks
  • Copies the job resources (yapılandırma, job JAR file, input splits) to a shared location, such as an HDFS directory, where it is accessible to the Job Tracker and Task Trackers
  • Submits the job to the Job Tracker

iş Tracker: Job Tracker performs the following tasks

  • Fetches input splits from the shared location where the Job Client placed the information
  • Creates a map task for each split
  • Assigns each map task to a Task Tracker (worker node)

After the map task is complete, Job Tracker does the following tasks

  • Creates reduce tasks up to the maximum enabled by the job configuration.
  • Assigns each map result partition to a reduce task.
  • Assigns each reduce task to a Task Tracker.

görev Tracker: Bir Görev Tracker bir işçi düğümün görevleri yönetir ve İş Tracker durumunu bildirir.

harita veya görevi azaltmak kendisine atandığında Görev Tracker aşağıdaki görevleri yapar

  • yerel iş kaynakları döndürür
  • işçi düğümünde bir çocuk JVM harita yürütmek veya görev azaltmak için çoğaltılır
  • İş Tracker durumunu bildirir

Harita azaltın hata ayıklama

Hadoop program çalışması sırasında önemli olayların günlüklerini tutar. By default, Bu günlüklerde saklanır / Hadoop sürümü / dizinin alt sizden Hadoop çalıştırdığı. Günlük dosyaları Hadoop-adı-hizmet-hostname.log adlandırılır. En son veriler .log dosyasında olduğu; Eski günlükleri kendi tarih onlara Sonuna. Günlük dosya içinde kullanıcı adı Hadoop başladı altında kullanıcı adı anlamına gelir — this is not necessarily the same username you are using to run programs. The service name refers to which of the several Hadoop programs are writing the log; these can be jobtracker, namenode, datanode, secondarynamenode, or tasktracker. All of these are important for debugging a whole Hadoop installation. But for individual programs, the tasktracker logs will be the most relevant. Any exceptions thrown by your program will be recorded in the tasktracker logs.

The log directory will also have a subdirectory called userlogs. Here there is another subdirectory for every task run. Each task records its stdout and stderr to two files in this directory. Note that on a multi-node Hadoop cluster, these logs are not centrally aggregated — you should check each TaskNode’s logs/userlogs/ directory for their output.

Debugging in the distributed setting is complicated and requires logging into several machines to access log data. If possible, programs should be unit tested by running Hadoop locally. The default configuration deployed by Hadoop runs in “single instance” mode, where the entire MapReduce program is run in the same instance of Java as called JobClient.runJob(). Using a debugger like Eclipse, you can then set breakpoints inside the map() or reduce() methods to discover your bugs.

Is reduce job mandatory?

Some jobs can complete all their work during the map phase. SO the Job can be map only job. To stop a job after the map completes, set the number of reduce tasks to zero.

Sonuç

This module described the MapReduce execution platform at the heart of the Hadoop system. By using MapReduce, a high degree of parallelism can be achieved by applications. The MapReduce framework provides a high degree of fault tolerance for applications running on it by limiting the communication which can occur between nodes.

============================================= ============================================== Buy best TechAlpine Books on Amazon
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share