YouTube Icon

Interview Questions.

50 Best Hadoop Interview Questions and Answers - Sep 08, 2021

fluid

50 Best Hadoop Interview Questions and Answers

Apache Hadoop is one of the maximum famous open-source initiatives for churning out Big Data. It is a powerful technology that allows groups and individuals to make sense out of massive chunks of records, particularly unstructured, in an efficient way at the same time as staying value-effective.

Several process profiles within the IT area regarding Big Data calls for an awesome understanding of Apache Hadoop.

Top Hadoop Interview Questions and Answers

If you’re making ready for such an interview, here are the pleasant Hadoop interview inquiries to put together for the equal or gauge your progress up till now:

Question: What is Hadoop? Name its additives.

Answer: Apache Hadoop is an open-source software program framework that offers a galore of equipment and services to keep and system Big Data. Decision-makers leverage Hadoop for analyzing Big Data and provide you with becoming enterprise decisions. Hadoop has the subsequent additives:

Processing framework

YARN

ResourceManager

NodeManager

Storage unit

HDFS

NameNode

DataNode

Question: Compare relational database management systems with HDFS (Hadoop Distributed File System)?

Answer: Following are the numerous variations between HDFS and RDBMS:

Data Storage - In an RDBMS, the schema of the statistics is usually regarded and handiest structured records is saved. On the opposite, Hadoop can save dependent, semi-structured, or even unstructured statistics.

Processing Ability - An RDBMS have little to no processing abilities. Hadoop, alternatively, lets in processing statistics, that's parallelly disbursed throughout the Hadoop cluster.

Schema Approach - Another major difference between HDFS and an RDBMS is the schema approach. While RDBMS follows the traditional schema-on-write technique, in which the schema is validated prior to loading the information, the HDFS follows the current schema-on-read technique.

Read/Write Speeds - Reads are speedy in RDBMSs as the schema is already known. Hadoop fosters faster writes as there's no schema validation at some stage in an HDFS write.

Pricing - Most RDBMSs are paid software program. Hadoop, contrarily, is an open-source framework with a huge community and a plethora of extra software program like gear and libraries.

Ideal Usage - The use of an RDBMS is constrained to OLTP systems. Hadoop, however, may be employed for statistics discovery, analytics, OLAP structures, etc.

Question: Please explain HDFS and YARN?

Answer: HDFS or Hadoop Distributed File System is the garage unit of Apache Hadoop. Following the grasp/slave topology, the HDFS stores numerous kinds of facts as blocks in a disbursed environment. It has  components:

NameNode - It is the grasp node that continues metadata referring to the stored facts blocks.

DataNodes - Slave nodes that store statistics within the HDFS. All DataNodes are managed via the NameNode.

Yet Another Resource Negotiator or YARN is the processing framework of Apache Hadoop, added in Hadoop 2. It is accountable for handling resources together with offering an execution surroundings for the tactics. YARN has 2 components:

ResourceManager - Receives the processing requests, which it then passes, in parts, consequently to the relevant NodeManagers. Also allocates assets to the apps, depending on their wishes.

NodeManager - Installed on every DataNode, liable for executing duties.

Question: Explain the diverse Hadoop daemons?

Answer: There are a complete of 6 Hadoop daemons in a Hadoop cluster:

NameNode - This is the grasp node that shops metadata of all of the directories and files of a Hadoop cluster. Contains records about blocks and their place in the cluster.

DataNode(s) - The slave node that stores the real statistics. Multiple in range.

Secondary NameNode - Merges adjustments - edit log - with the FsImage within the NameNode at regular durations of time. The changed FsImage saved within the chronic storage by the Secondary NameNode can be utilized in scenarios involving the failure of the NameNode.

ResourceManager - Responsible for managing assets as well as scheduling apps jogging on top of YARN.

NodeManager - It is answerable for:

Launching the application’s boxes

Monitoring the useful resource usage of the aforementioned

Report it's fame and monitoring information to the ResourceManager

JobHistoryServer - Maintains records about the MapReduce jobs put up-termination of the Application Master

NameNode, DataNode(s), and Secondary NameNode are HDFS daemons, even as ResourceManager and NodeManager are YARN daemons.

Question: Briefly provide an explanation for Hadoop structure?

Answer: Apache Hadoop structure, a.Ok.A. Hadoop Distributed File System or HDFS follows a Master/slave structure. Here, a cluster contains of a unmarried NameNode or the Master node and all the closing nodes are DataNodes or Slave nodes.

While the NameNode contains information about the information stored i.E. Metadata, DataNodes are where the statistics is truely saved in a Hadoop cluster.

Question: What are the differences between HDFS and NAS (Network Attached Storage)?

Answer: Following are the important factors of difference among HDFS and NAS:

1. Definition

Network-attached Storage is a record-stage pc statistics garage server linked to some pc community. Simply, NAS can be some software or hardware that gives offerings for storing in addition to having access to information files.

Hadoop Distributed File System, however, is a disbursed record machine that stores facts by way of commodity hardware.

2. Data Storage

While records is stored on dedicated hardware in NAS, HDFS shops information inside the form of statistics blocks which can be allotted across all of the machines comprising a Hadoop cluster.

3. Design

HDFS is designed in this kind of manner that it allows working with the MapReduce paradigm. Here, computation is shifted to the records. NAS is incompatible with the MapReduce paradigm because here records is saved separately from where the computation surely takes place.

Four. Cost

Since HDFS makes use of commodity hardware, the use of HDFS is a fee-powerful answer compared to the steeply-priced, dedicated, high-end garage devices required through NAS.

Question: What is the main distinction among Hadoop 1 and a pair of?

Answer: Hadoop became at first released in April of 2006. The first complete-blown Hadoop launch, Hadoop 1.0.0 changed into released in December 2011, and Hadoop 2.Zero.0 in October 2013. Hadoop 2 added YARN as a alternative to the MapReduce engine (MRv1) in Hadoop 1.

The central useful resource supervisor, YARN, enables jogging numerous apps in Hadoop, even as they all percentage a common useful resource. Hadoop 2 uses MRv2 - a distinct sort of distributed application - that executes the MapReduce framework on pinnacle of YARN.

Question: Please examine Hadoop 2 and three?

Answer: Hadoop three changed into released on thirteenth December 2017. Following are the critical variations among the Hadoop 2.X.X and Hadoop 3.X.X. Releases:

1. Point of Failure

In Hadoop 2, NameNode is the single point of failure. This posed a significant hassle for accomplishing high availability. Hadoop 3 resolved this trouble with the creation of energetic and passive NameNodes. When the lively NameNode fails, one of the passive NameNodes can take manipulate.

2. Application Development

Containers in Hadoop three work on the principle of Docker. It helps in decreasing the total time required for application development.

3. Erasure Coding

The implementation of erasure coding in Hadoop three consequences in a decreased garage overhead.

4. GPU Hardware Usage

There isn't any way of executing DL (deep learning) algorithms on a cluster in Hadoop 2. This is appended in Hadoop three with the capability to use GPU hardware within a Hadoop cluster.

Question: Briefly explain lively and passive NameNodes.

Answer: The energetic NameNode works and runs in a cluster. The passive NameNode has similar facts as that of the active NameNode. It replaces the active NameNode only whilst there may be a failure. Hence, its cause is to acquire a excessive diploma of availability.

Question: Why DataNodes are regularly added or eliminated from a Hadoop cluster?

Answer: There are  motives for including (commissioning) and/or eliminating (decommissioning) DataNodes often:

Utilizing commodity hardware

Scaling i.E. Accommodating rapid increase in data extent

Question: What will appear if two users try and get right of entry to the equal document in HDFS?

Answer: Upon receiving the request for opening the file, the NameNode grants a lease to the primary user. When the alternative person tries to do the identical, the NameNode notices that the rent is already granted and thereafter, will reject the get entry to request.

Question: Please give an explanation for how NameNode manages DataNode disasters?

Answer: The NameNode receives a periodical heartbeat message from each of the DataNodes in a Hadoop cluster, implying the right functioning of the identical. When a DataNode fails to send a heartbeat message, it is marked dead by the NameNode after a set time period.

Question: What do you recognize by Checkpointing?

Answer: Performed through the Secondary NameNode, Checkpointing reduces NameNode startup time. The process, in essence, entails combining FsImage with the edit log and compressing the two into a new FsImage.

Checkpointing allows the NameNode to load the final in-reminiscence kingdom immediately from the FsImage.

Question: Please explain how fault tolerance is executed in HDFS?

Answer: For reaching fault tolerance, HDFS has something called Replication Factor. It is the variety of times the NameNode replicates the information of a DataNode to a few other DataNodes.

By default, Replication Factor is three i.E. The NameNode shops 3 additional copies of the information saved on a unmarried DataNode. In case of a DataNode failure, the NameNode copies data from this type of replicas, hence making the statistics effortlessly to be had.

Question: How does Apache Hadoop range from Apache Spark?

Answer: There are several succesful cluster computing frameworks for assembly Big Data demanding situations. Apache Hadoop is an apt answer for studying Big Data while successfully coping with batch processing is the priority.

When the concern, however, is to successfully manage actual-time facts then we've got Apache Spark. Unlike Hadoop, Spark is a low latency computing framework capable of interactively processing data.

Although each Apache Hadoop and Apache Spark are popular cluster computing frameworks. That, but, doesn’t suggest that both are identical via all method. In actual, each cater to exceptional evaluation necessities of Big Data. Following are the diverse differences between the two:

Engine Type - While Hadoop is only a simple facts processing engine, Spark is a specialized statistics analytics engine.

Intended For - Hadoop is designed to cope with batch processing with Brobdingnagian volumes of statistics. Spark, on the other hand, serves the reason of processing real-time records generated via real-time events, which includes social media.

Latency - In computing, latency represents the distinction among the time whilst the guidance of the records switch is given and the time while the statistics transfer absolutely begins. Hadoop is a high-latency computing framework, while Spark is a low-latency computing framework.

Data Processing - Spark techniques facts interactively, whilst Hadoop can’t. Data is processed in the batch mode in Hadoop.

Complexity/The Ease of Use - Spark is easier to use way to an abstraction version. Users can easily procedure statistics with excessive-stage operators. Hadoop’s MapReduce version is complicated.

Job Scheduler Requirement - Spark functions in-reminiscence computation. Unlike Hadoop, Spark doesn’t require an outside task scheduler.

Security Level - Both Hadoop and Spark are relaxed. But while Spark is simply secured, Hadoop is tightly secured.

Cost - Since MapReduce version gives a less expensive strategy, Hadoop is less expensive as compared to Spark, which is dearer thanks to having an in-memory computing solution.

More in this? Check out this in-intensity Hadoop vs Spark assessment.

Question: What are the five V’s of Big Data?

Answer: The five V’s of Big Data are Value, Variety, Velocity, Veracity, and Volume. Each of them is explained as follows:

Value - Unless operating on Big Data yields consequences to improve the enterprise manner or sales or in some other way, it is vain. Value refers to the quantity of productiveness that Big Data brings.

Variety - refers back to the heterogeneity of statistics sorts. Big Data is to be had in a number of codecs, including audio files, CSVs, and motion pictures. These codecs represent the sort of Big Data.

Velocity - refers to the rate at which Big Data grows.

Veracity - Refers to the data doubtful or uncertainty of availability because of statistics inconsistency and incompleteness.

Volume - refers to the amount of Big Data, which is normally in Exabytes and Petabytes.

Question: What is the proper storage for NameNode and DataNodes?

Answer: Dealing with Big Data involves requiring quite a few storage area for storing humongous amounts of statistics. Hence, commodity hardware, such as PCs and laptops, is ideal for DataNodes.

As NameNode is the grasp node that stores metadata of all records blocks in a Hadoop cluster, it requires excessive memory space i.E. RAM. So, a high-end machine with suitable RAM is ideal for the NameNode.

Question: Please give an explanation for the NameNode restoration manner?

Answer: The NameNode healing procedure entails the following  steps:

Step 1 - Start a new NameNode the usage of the document system metadata replica i.E. FsImage.

Step 2 - Configure the DataNodes and clients so that they well known the brand new NameNode.

As quickly as the new NameNode completes loading the ultimate checkpoint FsImage and receives enough block reviews from the DataNodes, it's going to begin serving the customer.

Question: Why shouldn’t we use HDFS for storing quite a few small-length files?

Answer: HDFS is better-acceptable for storing a humongous quantity of data in a unmarried document in preference to a small quantity of facts throughout multiple files.

If you operate HDFS for storing quite a few small-length documents then the metadata of these files can be widespread in comparison to the entire statistics present in all of those documents. This will consequently require unnecessarily more quantity of RAM, making the entire method inefficient.

Question: What are the default block sizes in Hadoop 1, 2, and 3? How are we able to alternate it?

Answer: The default block length in Hadoop 1 is 64MB and the identical in Hadoop 2 and Hadoop 3 is 128MB. For putting the scale of a block as per to the necessities, the dfs.Block.Size parameter inside the hdfs-site.Xml report is used.

Question: How can we take a look at whether or not the Hadoop daemons are jogging or no longer?

Answer: In order to test whether or not the Hadoop daemons are running or now not, we use the jps (Java Virtual Machine Process Status Tool) command. It displays a listing of all the up and walking Hadoop daemons.

Question: What is Rack Awareness in Hadoop?

Answer: The set of rules by using which the NameNode makes selections, in preferred and comes to a decision how blocks and replicas are placed, to be particular, is known as Rack Awareness. The NameNode makes a decision on the premise of rack definitions and with the motive of minimizing community traffic amongst DataNodes inside the same rack.

The default Replication Factor for a Hadoop cluster is three. This approach for every block of data, three copies could be available. Two copies will exist in a single rack and the other one in some different rack. It is called the Replica Placement Policy.

Question: Please give an explanation for Speculative Execution in Hadoop?

Answer: Upon locating a node that is executing a undertaking slower, the master node executes some other instance of the identical undertaking on some other node. Out of the 2, the mission that first finishes is customary whilst the other one is killed. This is known as Speculative Execution in Hadoop.

Question: Please provide an explanation for the difference between HDFS Block and an Input Split?

Answer: An HDFS Block is is the bodily department of the saved records in a Hadoop cluster. On the opposite, the Input Split is the logical division of the same.

While the HDFS divides the stored records in blocks for storing them in an efficient manner, MapReduce divides the statistics into the Input Split and assign the equal to mapper function for further processing.

Question: What are the numerous modes wherein Apache Hadoop run?

Answer: Apache Hadoop runs in three modes:

Standalone/local mode - It is the default mode in Hadoop. All the Hadoop additives run as a single Java process on this mode and uses the neighborhood filesystem.

Pseudo-dispensed mode - A single-node Hadoop deployment runs inside the pseudo-allotted mode. All the Hadoop services are accomplished on a single compute node in this mode.

Fully distributed mode - In fully disbursed mode, the Hadoop master and slave services run one at a time on distinct nodes.

Question: How will you restart NameNode or all of the Hadoop daemons?

Answer: For restarting the NameNode:

Step 1 - First, input the /sbin/hadoop-daemon.Sh forestall namenode command to forestall the NameNode.

Step 2 - Now, enter the /sbin/hadoop-daemon.Sh begin namenode command to begin the NameNode.

For restarting all of the Hadoop daemons:

Step 1 - To stop all the Hadoop daemons, use the /sbin/prevent-all.Sh command.

Step 2 - To start all the Hadoop daemons another time, use the /sbin/begin-all.Sh command.

Question: Define MapReduce. What is the syntax for running a MapReduce software?

Answer: MapReduce is a programming version as well as an related implementation used for producing Big Data sets with a parallel, dispensed algorithm on a Hadoop cluster. A MapReduce application accommodates of:

Map Procedure - Performs filtering and sorting

Reduce Method - Performs a summary operation

The syntax for going for walks a MapReduce program is:

hadoop_jar_file.jar/input_path/output_path

Question: Enumerate the numerous configuration parameters that want to be specified in a MapReduce application?

Answer: Following are the diverse configuration parameters that users need to specify in a MapReduce program:

The enter format of statistics

Job’s enter area in the distributed report system

Job’s output vicinity in the distributed document gadget

The output layout of information

The elegance containing the map function

The class containing the reduce characteristic

The JAR document containing the mapper, reducer, and driver training

Question: Why it isn't feasible to perform aggregation in mapper? Why can we want reducer for the same?

Answer: Following are the numerous motives why it isn't always viable to carry out aggregation in mapper:

Aggregation requires the output of all the mapper capabilities, which won't be possible to gather in the map section due to the fact mappers might be running on distinct machines than the only containing the statistics blocks.

Aggregation can’t be achieved with out sorting and it doesn’t occur in the mapper feature.

It is attempted to mixture records at mapper, then there is the requirement for communique among all mapper functions. As one-of-a-kind mapper capabilities might be running on special machines, excessive community bandwidth is required that would result in community bottlenecking.

Assorting best takes place on the reducer facet, we require reducer characteristic to accomplish aggregation.

Question: Why will we need RecordReader in Hadoop? Where is it defined?

Answer: The Input Split is a part of the undertaking without any description at the manner it's miles to be accessed. The RecordReader elegance is responsible for loading the facts from its source and changing the equal into K,V (Key, Value) pair, suitable for analyzing by the Mapper challenge. Input Format defines an instance of the RecordReader.

Q: Please give an explanation for the Distributed Cache in a MapReduce framework?

Answer: The Distributed Cache is a utility supplied through the MapReduce framework for caching files required with the aid of packages. Once the consumer caches a report for a process, the Hadoop framework makes it to be had on all records nodes in which the map/reduce tasks are jogging. The cache document can be accessed as a nearby report inside the Mapper or Reducer job.

Question: Does the MapReduce programming version allows reducers to talk with each other?

Answer: Reducers run in isolation inside the MapReduce framework. There isn't any way of setting up conversation with each other.

Question: Please explain a MapReduce Partitioner?

Answer: The MapReduce Partitioner allows in frivolously distributing the map output over the reducers. It does so by using ensuring that each one the values of a single key go to the identical reducer.

The MapReduce Partitioner redirects the mapper output to the reducer through determining which reducer is responsible for a selected key.

Question: Can you provide an explanation for the steps to write a custom partitioner in Apache Hadoop?

Answer: Following is the step-by-step manner for writing a custom partitioner in Hadoop:

Step 1 - Create a brand new class that extends the Partitioner Class

Step 2 - Next, override getPartition technique within the wrapper class that runs inside the MapReduce

Step three - Now, you can either upload the custom partitioner to the activity as a config file or by means of the use of the Set Partitioner approach.

Question: What do you understand through Combiner in Hadoop?

Answer: Combiners decorate the performance of the MapReduce framework by decreasing the facts required sending to the reducers. A combiner is a mini reducer that is responsible for performing the nearby lessen venture.

A combiner receives the enter from the mapper on a particular node, and sends the output to the reducer.

Question: Can you provide an explanation for SequenceFileInputFormat?

Answer: Sequence documents are an green intermediate representation for facts passing from one MapReduce job to the other. They may be generated because the output of other MapReduce responsibilities.

The SequenceFileInputFormat is a compressed binary record layout optimized for passing records a number of the outputs of one MapReduce process and the enter of a few other MapReduce job. It is an enter layout for reading within collection documents.

Question: List some of the maximum exceptional applications of Apache Hadoop?

Answer: Apache Hadoop is an open-supply platform for accomplishing scalable and allotted computing of massive volumes of information. It gives a fast, performant, and value-effective manner of analyzing dependent, semi-based, and unstructured statistics. Following are a number of the exceptional use instances of Apache Hadoop:

Analyzing customer data in real-time

Archiving emails

Capturing and reading clickstream, social media, transaction, and video data

Content management

Fraud detection and prevention

Traffic management

Making experience out of unstructured facts

Managing content and media on social media systems

Scientific research

Streaming processing

Question: What are the benefits of the usage of Distributed Cache?

Answer: Using a Distributed Cache has the subsequent perks:

It can distribute some thing ranging from simple, study-handiest textual content files to complicated files like files.

It tracks the change timestamps of cache files.

Question: What is a Backup Node and a Checkpoint NameNode?

Answer: The Checkpoint NameNode creates checkpoints for namespace at ordinary intervals. It does so by downloading the FsImage, editing files, and merging the same in the local listing. Post merging, the brand new FsImage is uploaded to the NameNode. It has the equal directory structure as that of the NameNode.

The Backup Node is much like the Checkpoint NameNode in terms of capability. Although it keeps an up to date in-memory replica of the document system namespace, it doesn’t require noting modifications at everyday periods of time. In easy phrases, the Backup Node saves the present day country in-memory to an photograph file for creating a new Checkpoint.

Question: What are the not unusual enter codecs in Apache Hadoop?

Answer: Apache Hadoop has three common input formats:

Key-Value Input Format - Intended for undeniable textual content documents in which the files are damaged into strains

Sequence File Input Format - Intended for studying documents in sequence

Text Input Format - This is the default enter format in Hadoop

Question: Explain the center strategies of a Reducer?

Answer: There are three center techniques of a Reducer, defined as follows:

cleanup() - Used simplest as soon as on the quit of a assignment for cleansing the brief documents.

Lessen() - Always known as as soon as consistent with key with the related decreased mission.

Setup() - Used for configuring numerous parameters, including allotted cache and input data length.

Question: Please give an explanation for the role of a JobTracker in Hadoop?

Answer: A JobTracker in Hadoop cluster is liable for:

Resource control i.E. Coping with TaskTrackers

Task lifecycle control i.E. Tracking assignment development and responsibilities’ fault tolerance

Tracking useful resource availability

Question: How is the Map-side Join distinct from the Reduce-side Join?

Answer: The Map-side Join requires a strict shape. It is done when statistics reaches the Map and the input datasets have to be established. The Reduce-side Join is less difficult as there's no requirement for the enter datasets to be structured. The Reduce-side Join is less green than the Map-facet Join because it desires to go through sorting and shuffling phases.

Question: Do you already know a way to debug Hadoop code?

Answer: Start by using checking the list of MapReduce jobs that are currently going for walks. Thereafter, take a look at whether there are one or many orphaned jobs walking or now not. If there may be then it's miles required to determine the location of RM logs. This can be achieved as follows:

Step 1 - Use the ps grep -I ResourceManager command to look for the log directory within the end result. Find out the process ID and take a look at whether or not there's an error message with the orphaned job.

Step 2 - Use the RM logs to discover the worker node involved inside the execution of the undertaking concerning the orphaned task.

Step 3 - Log in to the affected node and run the following code:

ps -ef | grep -iNodeManager

Step 4 - Examine the Node Manager log. Most of the mistakes are from the consumer-level logs for every MapReduce task.

Conclusion

That sums up our list of the top Hadoop interview questions. Hope you discovered these helpful for preparing in your upcoming interview or simply checking your progress in gaining knowledge of Hadoop. And, don’t forget to test out those fine Hadoop tutorials to study Hadoop.




CFG