Below are a few more hadoop mapreduce interview questions and answers for experienced and freshers hadoop developers.
Hadoop Mapreduce Interview Questions and Answers for Experienced:
1. After restart of namenode, Mapreduce jobs started failing which worked fine before restart. What could be the wrong ?
The cluster could be in a safe mode after the restart of a namenode. The administrator needs to wait for namenode to exit the safe mode before restarting the jobs again. This is a very common mistake by Hadoop administrators.
2. What do you always have to specify for a MapReduce job ?
- The classes for the mapper and reducer.
- The classes for the mapper, reducer, and combiner.
- The classes for the mapper, reducer, partitioner, and combiner.
- None; all classes have default implementations.
3. How many times will a combiner be executed ?
- At least once.
- Zero or one times.
- Zero, one, or many times.
- It’s configurable.
4. You have a mapper that for each key produces an integer value and the following set of
Reducer A: outputs the sum of the set of integer values.
Reducer B: outputs the maximum of the set of values.
Reducer C: outputs the mean of the set of values.
Reducer D: outputs the difference between the largest and smallest values
in the set.
Which of these reduce operations could safely be used as a combiner ?
- All of them.
- A and B.
- A, B, and D.
- C and D.
- None of them.
Explanation: Reducer C cannot be used because if such reduction were to occur, the final reducer could receive from the combiner a series of means with no knowledge of how many items were used to generate them, meaning the overall mean is impossible to calculate.
Reducer D is subtle as the individual tasks of selecting a maximum or minimum are safe for use as combiner operations. But if the goal is to determine the overall variance between the maximum and minimum value for each key, this would not work. If the combiner that received the maximum key had values clustered around it, this would generate small results; similarly for the one receiving the minimum value. These sub ranges have little value in isolation and again the final reducer cannot construct the desired result.
5. What is Uber task in YARN ?
If the job is small, the application master may choose to run them in the same JVM as itself, since it judges the overhead of allocating new containers and running tasks in them as outweighing the gain to be had in running them in parallel, compared to running them sequentially on one node. (This is different to Mapreduce
1, where small jobs are never run on a single task tracker.)
Such a job is said to be Uberized, or run as an Uber task.
6. How to configure Uber Tasks ?
By default a job that has less than 10 mappers only and one reducer, and the input size is less than the size of one HDFS block is said to be small job. These values may
be changed for a job by setting mapreduce.job.ubertask.maxmaps , mapreduce.job.ubertask.maxreduces , and mapreduce.job.ubertask.maxbytes
It’s also possible to disable Uber tasks entirely by setting mapreduce.job.ubertask.enable to false.
7. What are the ways to debug a failed mapreduce job ?
Commonly there are two ways.
- By using mapreduce job counters
- YARN Web UI for looking into syslogs for actual error messages or status.
8. What is the importance of heartbeats in HDFS/Mapreduce Framework ?
A heartbeat in master/slave architecture is a signal indicating that it is alive. A datanode sends heartbeats to Namenode and node managers send their heartbeats to Resource Managers to tell the master node that these are still alive.
If the Namenode or Resource manager does not receive heartbeat from any slave node then they will decide that there is some problem in data node or node manager and is unable to perform the assigned task, then master (namenode or resource manager) will reassign the same task to other live nodes.
9. Can we rename the output file ?
Yes, we can rename the output file by implementing multiple format output class.
10. What are the default input and output file formats in Mapreduce jobs ?
If input file or output file formats are not specified, then the default file input or output formats are considered as text files.
A few more hadoop mapreduce interview questions and answers for experienced will be published in the upcoming posts in this category.