hadoop面试时可能遇到的问题
面试hadoop可能被问到的问题,你能回答出几个 ?
1、hadoop运行的原理?
2、mapreduce的原理?
3、HDFS存储的机制?
4、举一个简单的例子说明mapreduce是怎么来运行的 ?
5、面试的人给你出一些问题,让你用mapreduce来实现?
比如:现在有10个文件夹,每个文件夹都有1000000个url.现在让你找出top1000000url。
6、hadoop中Combiner的作用?
Src: http://p-x1984.javaeye.com/blog/859843
Following 2 are most common InputFormats defined in Hadoop
- TextInputFormat
- KeyValueInputFormat
- SequenceFileInputFormat
Q2. What is the difference between TextInputFormatand KeyValueInputFormat class
TextInputFormat:
It reads lines of text files and provides the offset of the line as key
to the Mapper and actual line as Value to the mapper
KeyValueInputFormat:
Reads text file and parses lines into key, val pairs. Everything up to
the first tab character is sent as key to the Mapper and the remainder
of the line is sent as value to the mapper.
InputSplithas defined a slice of work, but does not describe how to
access it. The RecordReaderclass actually loads the data from its source
and converts it into (key, value) pairs suitable for reading by the
Mapper. The RecordReader instance is defined by the InputFormat
is the process of determining which reducer instance will receive which
intermediate keys and values. Each mapper must determine for all of its
output (key, value) pairs which reducer will receive them. It is
necessary that for any key, regardless of which mapper instance
generated it, the destination partition is the same
the first map tasks have completed, the nodes may still be performing
several more map tasks each. But they also begin exchanging the
intermediate outputs from the map tasks to where they are required by
the reducers. This process of moving map outputs to the reducers is
known as shuffling.
task is responsible for reducing the values associated with several
intermediate keys. The set of intermediate keys on a single node is
automatically sorted by Hadoop before they are presented to the Reducer
Combiner is a "mini-reduce" process which operates only on data
generated by a mapper. The Combiner will receive as input all data
emitted by the Mapper instances on a given node. The output from the
Combiner is then sent to the Reducers, instead of the output from the
Mappers.
submits the work to the chosen Task Tracker nodes and monitors progress
of each task by receiving heartbeat signals from Task tracker
will restart the task again on some other task tracker and only if the
task fails more than 4 (default setting and can be changed) times will
it kill the job
parallelism by dividing the tasks across many nodes, it is possible for
a few slow nodes to rate-limit the rest of the program and slow down
the program. What mechanism Hadoop provides to combat this
tracker makes different task trackers process same input. When tasks
complete, they announce this fact to the Job Tracker. Whichever copy of a
task finishes first becomes the definitive copy. If other copies were
executing speculatively, Hadoop tells
the Task Trackers to abandon the tasks and discard their outputs. The
Reducers then receive their inputs from whichever Mapper completed
successfully, first.
What is the characteristic of streaming API that makes it flexible run
map reduce jobs in languages like perl, ruby, awk etc.
allows to use arbitrary programs for the Mapper and Reducer phases of a
Map Reduce job by having both Mappers and Reducers receive their input
on stdin and emit output (key, value) pairs on stdout.
Distributed
Cache is a facility provided by the Map/Reduce framework to cache files
(text, archives, jars and so on) needed by applications during
execution of the job. The framework will copy the necessary files to the
slave node before any tasks for the job are executed on that node.
This
is because distributed cache is much faster. It copies the file to all
trackers at the start of the job. Now if the task tracker runs 10 or 100
mappers or reducer, it will use the same copy of distributed cache. On
the other hand, if you put code in file to read it from HDFS in the MR
job then every mapper will try to access it from HDFS hence if a task
tracker run 100 map jobs then it will try to read this file 100 times
from HDFS. Also HDFS is not very efficient when used like this.
Q.24 What mechanism does Hadoop framework provides to synchronize changes made in Distribution Cache during runtime of the application
This is a trick questions. There is no such mechanism. Distributed Cache by design is read only during the time of Job execution
Q25. Have you ever used Counters in Hadoop. Give us an example scenario
Anybody who claims to have worked on a Hadoop project is expected to use counters
Q26. Is it possible to provide multiple input to Hadoop? If yes then how can you give multiple directories as input to the Hadoop job
Yes, The input format class provides methods to add multiple directories as input to a Hadoop job
Q27. Is it possible to have Hadoop job output in multiple directories. If yes then how
Yes, by using Multiple Outputs class
Q28. What will a hadoop job do if you try to run it with an output directory that is already present? Will it
- overwrite it
- warn you and continue
- throw an exception and exit
The hadoop job will throw an exception and exit.
Q29. How can you set an arbitary number of mappers to be created for a job in Hadoop
This is a trick question. You cannot set it
Q30. How can you set an arbitary number of reducers to be created for a job in Hadoop
You can either do it progamatically by using method setNumReduceTasksin the JobConfclass or set it up as a configuration setting
hadoop面试时可能遇到的问题的更多相关文章
- hadoop面试时的一些问题解答
一. linux部分 请阐述swap分区作用,您认为hadoop集群中的linux是否必须有swap分区? 答:在Linux中,如果一个进程的内存空间不足,那么,它会将内存中的部分数据 ...
- hadoop面试100道收集(带答案)
1.列出安装Hadoop流程步骤 a) 创建hadoop账号 b) 更改ip c) 安装Java 更改/etc/profile 配置环境变量 d) 修改host文件域名 e) 安装ssh 配置无密码登 ...
- 面试时遇到的SQL
CustomerID DateTime ProductName Price C001 2014-11-20 16:02:59 123 PVC 100 C001 2014-11-19 16:02:59 ...
- (Java后端 Java web)面试时如何展示自己非技术方面的能力(其实就是综合能力)
这篇文章的适用范围其实不仅限于Java后端或Java Web,不过其中有些是拿这方面举例的,在其它方面,大家可以举一反三,应该也能得到些启示. 我们在面试时,会发现有些候选人技术不错,比如在Java ...
- 面试时,当你有权提问时,别客气,这是个逆转的好机会(内容摘自Java Web轻量级开发面试教程)
前些天,我在博客园里写了篇文章,如何在面试中介绍自己的项目经验,收获了2千多个点击,这无疑鼓舞了我继续分享的热情,今天我来分享另外一个面试中的甚至可以帮助大家逆转的技巧,本文来是从 java web轻 ...
- 通过软引用和弱引用提升JVM内存使用性能的方法(面试时找机会说出,一定能提升成功率)
初学者或初级程序员在面试时如果能证明自己具有分析内存用量和内存调优的能力,这相当有利,因为这是针对5年左右相关经验的高级程序员的要求.而对于高级程序员来说,如果能在面试时让面试官感觉你确实做过内存调优 ...
- 面试时怎样回答:你对原生ajax的理解
很多人跟我一样用习惯了jq封装好的$.ajax,但是面试时,原生ajax是很多面试官喜欢问的问题,今天再查资料,打算好好整理一下自己理解的原生ajax. 首先,jq的ajax:一般我常用的参数就是这些 ...
- hadoop启动时,报ssh: Could not resolve hostname xxx: Name or service not known
本文转载自:http://blog.csdn.net/wodewutai17quiet/article/details/76795951 问题:hadoop启动时,报ssh: Could not re ...
- opensips编译安装时可能遇到的问题
错误一: ERROR: could not load the script in /usr/local//lib64/opensips/opensipsctl/opensipsdbctl.pgsql ...
随机推荐
- C# .NET 获取枚举值的自定义属性(特性/注释/备注)信息
一.引言 枚举为我看日常开发的可读性提供的非常好的支持,但是有时我们需要得到枚举值得描述信息或者是注释(备注)信息 比如要获得 TestEmun.aaa 属性值得备注 AAA,比较不方便得到. pub ...
- css 盒子模型理解
盒子模型是html+css中最核心的基础知识,理解了这个重要的概念才能更好的排版,进行页面布局.下面是自己积累和总结的关于css盒子模型的知识^_^,希望对初学者有用. 一.css盒子模型概念 CSS ...
- 10_控制线程_线程让步yield
[线程让步yield()方法] yield()方法可以让当前正在执行的线程暂停,但它不会阻塞该线程,它只是将该线程从运行状态转入就绪状态. 只是让当前的线程暂停一下,让系统的线程调度器重新调度一次. ...
- (int)、(int&)和(int*)的区别(转)
(1).首先通过一个例子看(int)和(int&)的区别: float a = 1.0f;cout << (int)a << endl;cout << (i ...
- Tian Ji -- The Horse Racing
Tian Ji -- The Horse Racing Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Jav ...
- JS中undefined和null的区别
在写JS脚本的时候,经常会碰到“为空”的判断,其中主要有null和undefined的判断.这两个为空判断的主要区别是: 1) null是JS的关键字,是语法特性.undefined是全局对象的属性, ...
- 001.XE3添加TPerlRegEx
TPerlRegEx 官方下载地址:http://www.regular-expressions.info/download/TPerlRegEx.zip 下载解压,打开pcre.pas文件可看到,直 ...
- django 中的延迟加载技术,python中的lazy技术
---恢复内容开始--- 说起lazy_object,首先想到的是django orm中的query_set.fn.Stream这两个类. query_set只在需要数据库中的数据的时候才 产生db ...
- poj 2175 Evacuation Plan 最小费用流判定,消圈算法
题目链接 题意:一个城市有n座行政楼和m座避难所,现发生核战,要求将避难所中的人员全部安置到避难所中,每个人转移的费用为两座楼之间的曼哈顿距离+1,题目给了一种方案,问是否为最优方案,即是否全部的人员 ...
- MVC-ActionResult解说
HttpNotFoundResult: 专门用来响应Http404找不到网页的错误,在System.Web.Mvc.Controller类别中内建了一个HttpNotFound()方法,可以很方便的回 ...