combiner就是规约操作,通过对map输出的数量进行规约,可以减少reduce的数量,提高执行效率 combiner的输入输出类型必须和mapper的输出以及reducer的输入类型一致
10、分别举例什么情况要使用 combiner,什么情况不使用? 求平均数的时候就不需要用combiner,因为不会减少reduce执行数量。在其他的时候,可以依据情况,使用combiner, 来减少map的输出数量,减少拷贝到reduce的文件,从而减轻reduce的压力,节省网络开销,提升执行效率
11、Hadoop中job和tasks之间的区别是什么? 首先通过jobTracker接收到了用户的操作请求之后,就会产生job任务,job然后将任务分配给tasks分配给多个机器去并行的 执行,通过将job任务分解为多个tasks任务并行的执行,提高了执行的效率。
12、hadoop中通过拆分任务到多个节点运行来实现并行计算,但某些节点运行较慢会拖慢整个任务的运行,hadoop采用全程机制应对这个情况? 对于那些较慢的tasks任务,hadoop 13、流API中的什么特性带来可以使map/reduce任务可以以不同语言(如perl, ruby, awk等)实现的灵活性?
14、有可能使hadoop任务输出到多个目录中吗?如果可以,怎么做? 可以,hadoop
15、如何为一个hadoop任务设置mappers的数量? 1 map的数量
map的数量通常是由hadoop集群的DFS块大小确定的,也就是输入文件的总块数,正常的map数量的并行规模大致是每一个Node是10~100个,对于CPU消耗较小的作业可以设置Map数量为300个左右,但是由于hadoop的没一个任务在初始化时需要一定的时间,因此比较合理的情况是每个map执行的时间至少超过1分钟。具体的数据分片是这样的,InputFormat在默认情况下会根据hadoop集群的DFS块大小进行分片,每一个分片会由一个map任务来进行处理,当然用户还是可以通过参数mapred.min.split.size参数在作业提交客户端进行自定义设置。还有一个重要参数就是mapred.map.tasks,这个参数设置的map数量仅仅是一个提示,只有当InputFormat 决定了map任务的个数比mapred.map.tasks值小时才起作用。同样,Map任务的个数也能通过使用JobConf 的conf.setNumMapTasks(int num)方法来手动地设置。这个方法能够用来增加map任务的个数,但是不能设定任务的个数小于
Hadoop系统通过分割输入数据得到的值。当然为了提高集群的并发效率,可以设置一个默认的map数量,当用户的map数量较小或者比本身自动分割的值还小时可以使用一个相对交大的默认值,从而提高整体hadoop集群的效率。
16、如何为一个hadoop任务设置要创建reduder的数量? 2 reduece的数量
reduce在运行时往往需要从相关map端复制数据到reduce节点来处理,因此相比于map任务。reduce节点资源是相对比较缺少的,同时相对运行较慢,正确的reduce任务的个数应该是0.95或者1.75 *(节点数 ×mapred.tasktracker.tasks.maximum参数值)。如果任务数是节点个数的0.95倍,那么所有的reduce任务能够在 map任务的输出传输结束后同时开始运行。如果任务数是节点个数的1.75倍,那么高速的节点会在完成他们第一批reduce任务计算之后开始计算第二批 reduce任务,这样的情况更有利于负载均衡。同时需要注意增加reduce的数量虽然会增加系统的资源开销,但是可以改善负载匀衡,降低任务失败带来的负面影响。同样,Reduce任务也能够与 map任务一样,通过设定JobConf 的conf.setNumReduceTasks(int num)方法来增加任务个数。
xxx信息技术有限公司 1、你们的集群规模?
开发集群:10台(8台可用)8核cpu
2、你们的数据是用什么导入到数据库的?导入到什么数据库?
处理之前的导入:通过hadoop命令导入到hdfs文件系统
处理完成之后的导出:利用hive处理完成之后的数据,通过sqoop导出到mysql数据库中,以供报表层使用
3、你们业务数据量多大?有多少行数据?(面试了三家,都问这个问题)
开发时使用的是部分数据,不是全量数据,有将近一亿行(8、9千万,具体不详,一般开发中也没人会特别关心这个问题)
4、你们处理数据是直接读数据库的数据还是读文本数据? 将日志数据导入到hdfs之后进行处理
5、你们写hive的hql语句,大概有多少条? 不清楚,我自己写的时候也没有做过统计
6、你们提交的job任务大概有多少个?这些job执行完大概用多少时间?(面试了三家,都问这个问题)
没统计过,加上测试的,会与很多
7、hive跟hbase的区别是? 这个可以百度
8、你在项目中主要的工作任务是? 利用hive分析数据
9、你在项目中遇到了哪些难题,是怎么解决的?
某些任务执行时间过长,且失败率过高,检查日志后发现没有执行完就失败,原因出在hadoop的job的timeout过短(相对于集群的能力来说),设置长一点即可
10、你自己写过udf函数么?写了哪些? 这个我没有写过
11、你的项目提交到job的时候数据量有多大?(面试了三家,都问这个问题) 不清楚是要问什么
12、reduce后输出的数据量有多大? 不清楚
1.一个网络商城1天大概产生多少G的日志? 2.大概有多少条日志记录(在不清洗的情况下)? 3.日访问量大概有多少个? 4.注册数大概多少?
5.我们的日志是不是除了apache的访问日志是不是还有其他的日志?
6.假设我们有其他的日志是不是可以对这个日志有其他的业务分析?这些业务分析都有什么(*********)
1.问:你们的服务器有多少台? 2.问:你们服务器的内存多大?
3.问:你们的服务器怎么分布的?(这里说地理位置分布,最好也从机架方面也谈谈) 4.问:你平常在公司都干些什么(一些建议)
下面是HBASE我非常不懂的地方: 1.hbase怎么预分区?
2.hbase怎么给web前台提供接口来访问(HTABLE可以提供对HTABLE的访问,但是怎么查询同一条记录的多个版本数据)?
3.htable API有没有线程安全问题,在程序中是单例还是多例?
4.我们的hbase大概在公司业务中(主要是网上商城)大概都几个表,几个表簇,大概都存什么样的数据?
5.hbase的并发问题?
下面的Storm的问题:
1.metaq消息队列 zookeeper集群 storm集群(包括zeromq,jzmq,和storm本身)就可以完成对商城推荐系统功能吗?还有没有其他的中间件?
2.storm怎么完成对单词的计数?(个人看完storm一直都认为他是流处理,好像没有积攒数据的能力,都是处理完之后直接分发给下一个组件) 3.storm其他的一些面试经常问的问题?
xxx信息技术有限公司 1、你们的集群规模?
2、你们的数据是用什么导入到数据库的?导入到什么数据库?
3、你们业务数据量多大?有多少行数据?(面试了三家,都问这个问题) 4、你们处理数据是直接读数据库的数据还是读文本数据? 5、你们写hive的hql语句,大概有多少条?
6、你们提交的job任务大概有多少个?这些job执行完大概用多少时间?(面试了三家,都问这个问题)
7、hive跟hbase的区别是?
8、你在项目中主要的工作任务是?
9、你在项目中遇到了哪些难题,是怎么解决的? 10、你自己写过udf函数么?写了哪些?
11、你的项目提交到job的时候数据量有多大?(面试了三家,都问这个问题) 12、reduce后输出的数据量有多大?
本文引用自神之子《hadoop面试可能遇到的问题》
Q1. Name the most common InputFormats defined in Hadoop? Which one is default ?
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.
Q3. What is InputSplit in Hadoop
When a hadoop job is run, it splits input files into chunks and assign each split to a mapper to process. This is called Input Split
Q4. How is the splitting of file invoked in Hadoop Framework
It is invoked by the Hadoop framework by running getInputSplit()method of the Input format class (like FileInputFormat) defined by the user Q5. Consider case scenario: In M/R system, - HDFS block size is 64 MB
- Input format is FileInputFormat
- We have 3 files of size 64K, 65Mb and 127Mb
then how many input splits will be made by Hadoop framework? Hadoop will make 5 splits as follows - 1 split for 64K files - 2 splits for 65Mb files - 2 splits for 127Mb file
Q6. What is the purpose of RecordReader in Hadoop
The 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
Q7. After the Map phase finishes, the hadoop framework does
\ - Partitioning
Partitioning 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
- Shuffle
After 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. - Sort
Each reduce 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 Q9. If no custom partitioner is defined in the hadoop then how is data partitioned before its sent to the reducer