Hadoop Interview Questions and Answers: Mastering Big Data Processing

hadoop interview questions and answers

Hadoop Interview Questions and Answers: Mastering Big Data Processing



Apache Hadoop is an open-source software library used in large data applications to handle data processing and storage. Hadoop enables the parallel and rapid analysis of large amounts of data. The Apache Software Foundation introduced Apache Hadoop to the public in 2012. (ASF). Hadoop is cost-effective to employ because data is stored on low-cost commodity servers that run in clusters.


Prior to the digital age, the volume of data collected was slow and could only be evaluated and saved using a single storage format. Simultaneously, the format of the data received for similar reasons was the same. However, with the rise of the Internet and digital platforms such as social media, data now comes in a variety of formats (structured, semi-structured, and unstructured), and its velocity has increased dramatically. This data has been given a new name: Big data. The necessity for many processors and storage units arose as a result of the big data. As a result, Hadoop was introduced as a solution.


Hadoop Interview Questions for Freshers 

  • Explain big data and list its characteristics.

Large and complicated data sets that are difficult to process using typical data processing techniques are referred to as big data. These data sets can be structured, semi-structured, or unstructured and can come from a range of sources, including social media, sensor data, and transactional data.


Big data characteristics are commonly referred to as the “four Vs”:


Volume: the sheer amount of data, which can be quantified in terabytes, petabytes, or even exabytes.


Velocity: the rate at which data is generated and processed, which can be quantified in real-time or near real-time.


Variety: the various types of data included in large data sets, such as text, photos, audio, and video.


Variability: the degree to which data fluctuates over time, or the degree to which data is inconsistent or incomplete.


Hadoop is a free and open-source software platform that enables the distributed processing of huge data volumes across computer clusters. It is intended to handle the vast volume, high velocity, and variety of data that characterises big data sets, and it is frequently used in tandem with other big data technologies such as Apache Spark, Apache Hive, and Apache Hbase.

  • Explain Hadoop. List the core components of Hadoop

Hadoop is a free and open-source software platform that enables the distributed processing of huge data volumes across computer clusters. It is intended to handle the huge volume, high velocity, and variety of data that comprise massive data sets. Hadoop is written in Java and is based on the Google File System (GFS) and the MapReduce programming style.


Hadoop’s primary components are as follows:


HDFS (Hadoop Distributed File System) is a distributed file system that stores data across numerous machines in a cluster. HDFS is intended to handle massive amounts of data while also allowing for high-throughput access to that data.


YARN: a resource management system that schedules and manages resources across a Hadoop cluster. It is in charge of assigning resources to the many apps running on the cluster.


MapReduce is a programming methodology for parallelizing big data sets across a cluster of processors. It is built on the map and reduce functions for processing and aggregating data.


Hadoop Common: a collection of utilities and libraries utilised by other Hadoop modules.


Hadoop Ozone is a Hadoop object store that provides a simple, high-performance, and scalable storage solution.


Hadoop YARN: A resource management system that allows Hadoop to manage and plan resources across a cluster.


Hadoop MapReduce is a programming methodology that allows big data sets to be processed in parallel over a cluster of servers.


HDFS (Hadoop Distributed File System): A distributed file system that allows data to be stored across numerous machines in a cluster.

  • Explain the Storage Unit In Hadoop (HDFS).

Hadoop’s storage unit is the Hadoop Distributed File System (HDFS), which is designed to store and manage huge volumes of data across a cluster of commodity machines. HDFS is a distributed file system that stores data across numerous machines in a cluster and is designed to handle big, streaming data reads.


HDFS stores data in blocks of 128MB or 256MB in size, which are duplicated across several machines in the cluster for fault tolerance. Each block is stored on a DataNode, which is a cluster machine that runs an HDFS daemon. The NameNode, the master node of the HDFS cluster, handles the file system namespace and keeps metadata about the file system’s files and directories, including the position of blocks on the DataNodes.

  • Mention different Features of HDFS.

The Hadoop Distributed File System (HDFS) includes several main properties that make it well-suited for large-scale data storage and processing:


Distributed Storage: HDFS distributes data over numerous machines in a cluster, allowing for scalability and fault tolerance.


High scalability: HDFS can manage clusters with thousands of nodes and petabytes of data.


High throughput: HDFS is designed for high-throughput data access, including support for streaming reads of huge files.


High availability: HDFS replicates data blocks across numerous machines so that if one machine dies, the data can still be accessible from another.


Data locality: To reduce network traffic and enhance performance, HDFS can take advantage of data locality by conducting compute operations on the same machines that store the data.


Data Integrity: HDFS provides a checksum for data at rest, and DataNode verifies the data it receives before storing it using a checksum.


HDFS replicates data blocks across numerous machines to provide fault tolerance and high availability.


Self-Healing: In the event of a node failure, HDFS automatically replicates data blocks to other nodes in the cluster, and it also finds and corrects data replica discrepancies.


Federation: HDFS permits many NameNodes/Namespaces to coexist in the same cluster, allowing multiple independent clusters to live within the same physical cluster.


HDFS supports the creation of snapshots of files and directories, which are read-only copies of the original file/directory.


File and directory permissions are supported by HDFS, providing for fine-grained access control to files and directories.


Data compression: HDFS offers on-the-fly data compression, which reduces the amount of storage space required and the quantity of data sent across the network.

  • What are the Limitations of Hadoop 1.0 ?

Hadoop 1.0, also known as Hadoop Classic, is the original version of the Hadoop software framework and has numerous drawbacks when compared to subsequent versions. The following are some of Hadoop 1.0’s major limitations:


Hadoop 1.0 contains a single NameNode that serves as the master node and handles the file system namespace and block locations. This means that if the NameNode fails, the entire cluster goes down.


Limited scalability: Due to restrictions in the NameNode’s ability to maintain the metadata of big clusters, Hadoop 1.0 cannot extend beyond a specific number of nodes.


Lack of real-time data processing capabilities: Hadoop 1.0 is designed for batch processing and does not allow real-time or low-latency data access.


Limited resource management: Hadoop 1.0 lacks an integrated resource management system, making it difficult to prioritise jobs and allocate resources efficiently.


Hadoop 1.0 is based on the MapReduce programming model and does not handle other sorts of workloads, such as interactive queries or real-time streaming data processing.


Lack of fine-grained access control: While Hadoop 1.0 includes basic file permissions, it lacks advanced access control features such as role-based access control and attribute-based access control.


Lack of data locality support: Hadoop 1.0 does not consider data locality when scheduling activities, which might result in higher network traffic and poor performance.


Security flaws: Hadoop 1.0 lacks built-in security capabilities such as data encryption, authentication, and authorization.

  • Compare the main differences between HDFS (Hadoop Distributed File System ) and Network Attached Storage(NAS) ?

Both HDFS (Hadoop Distributed File System) and Network Attached Storage (NAS) are distributed file systems, however they differ significantly:


Data Processing: HDFS is designed for large-scale data processing and is frequently used in conjunction with big data processing frameworks such as MapReduce, whereas NAS is designed for general-purpose file storage and sharing.


Scalability: HDFS is built to manage massive volumes of data and thousands of nodes, whereas NAS is typically designed to handle fewer nodes and less data.


Data Replication: HDFS replicates data blocks across several machines in the cluster, providing fault tolerance and high availability, whereas NAS often uses RAID or other data redundancy techniques to guard against data loss.


HDFS is optimised for streaming reads of huge files, whereas NAS is optimised for random access and tiny file operations.


Data locality: When scheduling activities, HDFS considers data locality, which can result in enhanced performance and lower network traffic. This feature is not available in NAS.


Security: HDFS provides basic file permissions and user authentication, whereas NAS often incorporates more comprehensive security features like as encryption, role-based access control, and other advanced capabilities.


Data integrity: HDFS provides a checksum for data at rest, and DataNode verifies the data it receives before storing it using a checksum. This feature is not available on NAS.


HDFS supports the creation of snapshots of files and directories, which are read-only copies of the original file/directory. This feature is not available on NAS.


Federation: HDFS permits many NameNodes/Namespaces to coexist in the same cluster, allowing multiple independent clusters to live within the same physical cluster. This feature is not available on NAS.

  • List Hadoop Configuration files.

In Hadoop, multiple configuration files are used to configure various parameters and settings for the Hadoop cluster. The following are some of the most important Hadoop configuration files:


core-site.xml: This file provides Hadoop fundamental configuration settings such as the filesystem to utilise, the IP address and port of the NameNode, and the HDFS replication factor.


hdfs-site.xml: This file provides HDFS-specific configuration settings like as block size, replica count, and the location of the NameNode and DataNode folders.


mapred-site.xml: This file provides MapReduce framework-specific configuration settings, such as the number of map and reduce jobs, the location of the JobTracker, and the framework to use for task scheduling.


yarn-site.xml: This file includes configuration parameters for YARN, Hadoop’s resource management system. It provides ResourceManager and NodeManager settings, as well as the scheduler for allocating resources.


slaves: This file contains a list of all of the cluster machines that will execute DataNode and TaskTracker.


hadoop-env.sh: This file contains Hadoop installation environment variables such as the location of the Java installation and the Hadoop home directory.


log4j.properties: This file contains Hadoop logging properties such as log detail level and log file location.


hdfs-default.xml: This file includes HDFS’s default configuration parameters.


mapred-default.xml: This file includes MapReduce’s default configuration parameters.


yarn-default.xml: This file includes YARN’s default configuration parameters.

  • Explain Hadoop MapReduce.

Hadoop MapReduce is a programming model and software framework for parallelizing the processing of huge data sets over a cluster of commodity devices. It is built on the map and reduce functions for processing and aggregating data.


The MapReduce process is divided into two parts: the map task and the reduce task. The map task takes each input data item and applies a user-defined function (the “map function”) on it, producing a set of intermediate key-value pairs as output. The reduce task performs a set of output values by applying another user-defined function (the “reduce function”) to all intermediate values with the same key.


MapReduce was superseded as a Resource Manager in Hadoop 2.x by YARN (Yet Another Resource Negotiator), which provides a more general and robust resource management framework. Other processing models, such as interactive, real-time, and graph processing, can coexist with MapReduce on a Hadoop cluster thanks to YARN, which allows several data processing frameworks to run on a same cluster and share resources.

  • What is shuffling in MapReduce?

The process of transferring the intermediate key-value pairs created by the mapper processes to the reducer tasks is referred to as shuffling in MapReduce. The shuffle process is in charge of sorting and grouping the intermediate key-value pairs generated by the mapper tasks so that all values with the same key are routed to the same reducer. This enables the reducer jobs to combine all of the data for a given key and produce the final result.


During the shuffling phase, the framework first sorts and organises the intermediate key-value pairs based on the key. The sorted and aggregated key-value pairs are then delivered over the network to the appropriate reducer task.


Shuffling is an important phase in the MapReduce process because it allows the reducer tasks to complete the final data gathering and computation. It also has an impact on the overall performance of the MapReduce operation because it might generate a substantial quantity of network traffic and IO. As a result, the framework includes various tuning options for optimising the shuffling process, such as compression and data serialisation, in order to save network traffic and IO.

  • List the components of Apache Spark.

Apache Spark is a fast and general-purpose Hadoop-based cluster computing system. It has several main components and provides a high-level API for distributed data processing:


Spark Core: Spark’s basis, it offers basic Spark features such as task scheduling, memory management, and fault recovery.


Spark SQL: Allows SQL queries on structured data, as well as a DataFrame API for Python, Java, and Scala programming.


Spark Streaming: Enables real-time data stream processing and integration with systems such as Kafka, Flume, and Kinesis.


Spark MLlib: A machine learning algorithm and utility package for large-scale data mining.


Spark GraphX: A graph processing package that enables the production, manipulation, and analysis of graph-structured data.


SparkR is a R programming package that enables for distributed data processing using the R language.


Spark may run on a variety of cluster managers, including standalone, Apache Mesos, Hadoop YARN, and Kubernetes.


Spark libraries: Spark contains libraries for a variety of use cases, including SQL-based data processing, machine learning, graph processing, and streaming.


Spark Web UI: Spark includes a web-based user interface for monitoring and debugging Spark jobs, as well as accessing extensive analytics about the cluster and job performance.


All of these components work together to provide a robust distributed data processing platform that can quickly grow to accommodate large data workloads. Spark is intended to be fast and simple to use, and it supports a variety of programming languages such as Python, Java, Scala, and R.

  • What are the three modes that hadoop can Run?

Hadoop may operate in three modes:


Standalone mode: This is Hadoop’s default mode, and it does not rely on any other cluster management software. In standalone mode, the NameNode, DataNode, and JobTracker are all run on the same system, as are the jobs. It is the most basic mode of operation for Hadoop and is often used for testing and development.


Pseudo-distributed mode: Hadoop runs on a single system but simulates a distributed environment by running various daemons (NameNode, DataNode, JobTracker, and TaskTracker) on separate processes. This mode is suitable for testing and development, as well as small-scale production installations.


Fully distributed mode: In this mode, Hadoop runs on a cluster of servers and manages resources and tasks using a cluster manager such as Apache Mesos, Hadoop YARN, or Kubernetes. This mode is suitable for large-scale production installations because it can manage very huge data volumes while maintaining high availability and fault tolerance.


It’s worth noting that Hadoop 3.x introduced the concept of erasure coding for HDFS storage, which allows for lower storage costs at the expense of lower write performance.

  • What is an Apache Hive?

Apache Hive is a Hadoop data warehouse and SQL-like query language. It includes a simple SQL-like language called HiveQL (Hive Query Language) for performing data analysis and querying on big data sets stored in the Hadoop Distributed File System (HDFS) or other Hadoop-supported storage systems. Hive also has a way for projecting structure onto this data and querying it with SQL-like terminology.


Hive is a data warehouse solution that allows you to do data warehousing operations including data summarization, querying, and analysis on huge datasets stored in Hadoop files by utilising a SQL-like language called HiveQL, as well as a number of tools for data ETL, data modelling, and data discovery. It also allows you to access data stored in HDFS and other Hadoop-supported storage systems via external tables. This enables users to gain unified access to data from Hive and other data processing technologies such as Pig and MapReduce.

  • What is Apache Pig?

Apache Pig is a high-level programming framework for developing applications that run on Apache Hadoop. It is intended to make it easier to create programmes that use Hadoop’s MapReduce algorithm to process massive data collections. Pig has a high-level programming language called Pig Latin that is akin to SQL, as well as a compiler that converts Pig Latin scripts into MapReduce jobs that can be run on a Hadoop cluster. Pig also has built-in operators for standard data processing operations including filtering, grouping, and merging data.

  • Explain the Apache Pig architecture.

Apache Pig is a high-level programming tool used to work with big data sets spread over a cluster of computers via the Hadoop Distributed File System (HDFS). The Pig architecture is made up of two parts: the Pig Latin language and the Pig Execution Engine.


Pig Latin is a high-level data flow language for expressing data processing activities. Similar to SQL, it allows users to express data operations using a simple, short syntax. Pig Latin programmes are then translated into a sequence of MapReduce tasks that the Pig Execution Engine executes.


Pig Execution Engine: The Pig Execution Engine is in charge of carrying out Pig Latin programmes. It translates Pig Latin scripts into MapReduce tasks and sends them to the Hadoop cluster for execution. The Pig Execution Engine also includes a variety of efficiency optimizations for Pig Latin programmes, including as memory-based caching and the ability to conduct several operations in a single MapReduce task.


In summary, Pig is a high-level programming platform that runs on top of Hadoop, allowing users to perform complex data processing tasks using a simple, SQL-like language called Pig Latin, which is then translated into a series of MapReduce jobs, which are then executed by the Pig Execution engine, which is optimised to improve the performance of the Pig Execution engine.

  • What is Yarn?

YARN (Yet Another Resource Negotiator) is a Hadoop cluster resource management and task scheduling solution. It was added in Hadoop version 2 to give a more flexible and effective means of controlling cluster resources.

  • List the YARN components.

The ResourceManager and the NodeManager are the two primary components of YARN.


The ResourceManager is the master node in charge of allocating cluster resources like as CPU, memory, and storage. It accepts resource requests from application managers and assigns them to the appropriate nodes depending on available resources.


The NodeManager is the slave node that runs on each machine in the cluster and is in charge of managing the machine’s resources. It connects with the ResourceManager to report available resources and, if necessary, to request additional resources.

  • What is Apache ZooKeeper?

Apache ZooKeeper is a distributed coordination service that is frequently used with Apache Hadoop and other distributed systems. It provides a simple and dependable method for coordinating and managing dispersed systems.


ZooKeeper provides various critical services, including:


Configuration management: ZooKeeper enables apps to store and retrieve configuration information in a centralised and consistent manner.


Group services: ZooKeeper enables applications to build, manage, and track groups of nodes. This is useful for executing leader election and other group coordinating duties.


Naming service: ZooKeeper allows applications to register and seek up names for nodes and services in the cluster.


Synchronization: ZooKeeper enables applications to coordinate and synchronise the activities of numerous cluster nodes.


Notification: ZooKeeper allows applications to be notified when certain nodes or services change.

  • What are the Benefits of using zookeeper?

ZooKeeper is a distributed coordination service that is extensively used in Hadoop to manage distributed systems. Some advantages of utilising ZooKeeper in Hadoop include:


Synchronization: ZooKeeper can be used to synchronise the behaviour of distributed systems, guaranteeing that all nodes in a cluster are working towards the same goal.


Configuration management: ZooKeeper may be used to store and manage configuration information for a Hadoop cluster, making it simple to update configurations without having to manually update each node.


Group services: ZooKeeper can be used to manage node groups, such as selecting a group leader or managing the membership of a distributed system.


ZooKeeper is a naming service that can be applied to Hadoop services, making it simple for clients to locate and connect to the necessary services.


ZooKeeper is built to be highly available and can withstand the failure of a few nodes without impairing the cluster’s overall performance.

  • Mention the types of Znode.

A znode is a node in the ZooKeeper data tree, much like a file or directory in a file system, in ZooKeeper. In ZooKeeper, there are various znode kinds, including:


Znodes that are persistent survive restarts of the ZooKeeper service because they are kept on disc. Typically, they are employed to store configuration data or other data that must be accessible even if the service is restarted.


Ephemeral znodes: These znodes are erased when the client that produced them disconnects from the ZooKeeper service and are not saved on disc. They are frequently employed for transient data, such as node status details.


Persistent Sequential znodes: These znodes are comparable to persistent znodes but differ in that their node names are prefixed with a distinct, monotonically increasing sequence number. This is helpful when you want to identify a node uniquely but don’t want to deal with naming disputes.


Ephemeral Sequential znodes: These znodes resemble ephemeral znodes but have the additional feature of having a distinct, monotonically growing sequence number appended to the node name.


Container: These znodes do not store any data on their own; instead, they solely act as parents to other znodes.

  • List Hadoop HDFS Commands.

The Hadoop HDFS (Hadoop Distributed File System) is a distributed file system created to store massive volumes of data on a cluster of inexpensive hardware. Here are a some of the most used HDFS commands:


hdfs dfs -ls: Lists the files and directories in a directory.


 hdfs dfs -mkdir : Creates a new directory


hdfs dfs -put: Copies a file from the local file system to HDFS.


hdfs dfs -get: Copies a file from HDFS to the local file system.


hdfs dfs -cp: This command duplicates a file or directory within HDFS.


hdfs dfs -mv: This command renames a file or directory in HDFS.


hdfs dfs -rm: This command deletes a file or directory from HDFS.


hdfs dfs -cat: This command displays the contents of a file in HDFS.


hdfs dfs -tail: Shows the last portion of a file in HDFS.


hdfs dfs -chmod: Modifies the permissions of an HDFS file or directory.


hdfs dfs -chown: Changes the owner and/or group of an HDFS file or directory.


hdfs dfs -du: Displays a file or directory’s disc use within HDFS.


hdfs dfs -expunge: Removes deleted files from the trash and frees up space.


hdfs dfs -help: Displays HDFS command help information.

  • Mention features of Apache sqoop.

Apache Sqoop is a mechanism for moving data between Hadoop and structured data storage like relational databases. Sqoop has the following features:


Data import and export: Sqoop makes it simple to move data between Hadoop and structured data repositories.


Data store support: Sqoop supports a wide range of structured data stores, including MySQL, Oracle, PostgreSQL, and Microsoft SQL Server.


Sqoop can import data incrementally, only adding fresh data to Hadoop, which saves time and resources.


Data transmission in parallel: Sqoop can transfer data in parallel, which improves performance dramatically.


Enormous dataset support: Sqoop can easily manage large datasets, making it a great tool for big data applications.


Custom mappers: Sqoop enables for the creation of custom mappers to meet unique import/export needs.


Interoperability with other Hadoop tools: Sqoop integrates readily with other Hadoop ecosystem technologies like as Pig, Hive, and Oozie.


Sqoop supports several data transport protocols, including Avro, JSON, and Sequence files.


SQL Select Support: By specifying a SQL statement, Sqoop allows you to import a specific subset of data from a table.


Hadoop Interview Questions for Experienced : 

  • What is DistCp?

DistCp (short for Distributed Copy) is a Hadoop utility that enables large-scale data copying within or between Hadoop clusters. DistCp parallelizes the copy process using MapReduce, making it more efficient than standard file copying tools. DistCp has the following features:


Large dataset support: DistCp is built to handle large datasets easily, making it an appropriate tool for big data applications.


Parallel data transfer: DistCp can transport data in parallel, which improves performance dramatically.


DistCp supports many file systems and may copy data between them, including HDFS, S3, and local file systems.


Support for maintaining file properties: During the copy process, DistCp can preserve file attributes such as permissions, ownership, and timestamps.


Overwriting and updating support: DistCp can be set to overwrite or update existing files during the copy operation.


Filtering support: DistCp supports filtering source files based on defined criteria.


Dynamic source file listing support: DistCp can copy files that are discovered dynamically during the copy operation.


Customizable mapper count: DistCp can be customised to use a certain number of mappers, which can enhance speed in certain cases.

  • Why are blocks in HDFS huge?

Blocks in HDFS (Hadoop Distributed File System) are huge for numerous reasons:


Large file handling: HDFS is built to manage very huge files, and dividing a large file into smaller blocks enables for more efficient data storage and retrieval.


Reduced metadata overhead: By adopting large block sizes, HDFS decreases the amount of metadata (file-specific information) that must be kept and managed. This has the potential to improve performance and scalability.


Improving data locality: HDFS may store many blocks of a file on the same node by employing high block sizes, which improves data locality and reduces network traffic.


Improving replication: For fault tolerance, HDFS replicates each block of a file to many nodes in the cluster. Larger block sizes require fewer blocks to be replicated, which improves performance and reduces network traffic.


Handling network bandwidth: HDFS’s default block size is 128MB, which is bigger than the normal file system block size. This enables HDFS to take use of the high-bandwidth networks seen in a Hadoop cluster.

  • What is the default replication factor?

The replication factor in Hadoop HDFS (Hadoop Distributed File System) is set to 3 by default.


The number of copies of a file saved on different nodes in the HDFS cluster is referred to as the replication factor. HDFS stores three copies of each file block on various nodes in the cluster by default. This ensures that if one of the nodes storing a copy of the block fails or becomes inaccessible, the block can still be accessed from another copy.


The replication factor can be configured on a per-file or cluster-wide basis. When a file is created, the replication factor defined for that file is utilised, or if no replication factor is specified, the cluster-wide default is applied.


The replication factor can be adjusted to any value larger than or equal to one, although for production clusters, it is typically suggested that it be set to at least three to ensure data availability and fault tolerance.


The HDFS command “hdfs dfs -setrep” can also be used to adjust the replication factor of a file after it has been created.


It’s important to note that increasing the replication factor will increase the storage space needed by HDFS while decreasing overall cluster performance due to the network traffic generated by duplicating data across nodes.

  • How can you skip the bad records in Hadoop?

There are a few ways to skip problematic records in Hadoop while processing data:


Using a custom InputFormat: You can filter out undesirable records before passing them to the mapper by using a custom InputFormat. To accomplish this, override the RecordReader class and skip any records that do not adhere to the required format.


Using a custom mapper: You can also disregard problematic records by implementing a custom mapper that looks for them. This can be achieved by processing the input records using a try-catch block, handling any exceptions that come up, and then skipping over any records that throw exceptions.


Using a filter: Before passing bad records to the mapper, you can use a filter to remove them. This can be accomplished by putting in place a custom filter that looks for problematic records and disregards them.


Using Pig or Hive: When processing data, Pig and Hive both offer built-in functionality to skip bad records. Bad records can be filtered away either using UDFs or the built-in functions that are available.


It’s crucial to remember that some methods may be more suited than others depending on the type of data and the specific problem you are trying to solve.

  • Where are the two types of metadata that NameNode server stores?

The NameNode server in Hadoop HDFS (Hadoop Distributed File System) contains two types of metadata:


Metadata for file system namespaces: This metadata includes details on the file system namespace, such as directory structure, file names, and file permissions. It keeps track of the hierarchical organisation of files and directories, as well as the position of file blocks.


Block location metadata: This metadata describes the position of blocks on the cluster’s DataNodes. It keeps track of the DataNodes that hold replicas of each block and is used to decide where data should be read or written.


The NameNode server stores both forms of metadata in memory for quick access and to reduce disc I/O. This is significant since the NameNode is a single point of failure, and it must be able to provide the metadata to clients rapidly as well as recover the metadata from the last saved checkpoint if a problem occurs.

  • Which Command is used to find the status of the Blocks and File-system health?

The command used to determine the state of blocks and file-system health in Hadoop HDFS (Hadoop Distributed File System) is:


hdfs dfsadmin -report


This command generates a report with information on the HDFS cluster, such as the number of live and dead DataNodes, the number of blocks and under-replicated blocks, and the cluster’s total and remaining capacity. It also displays the general health of the file system as well as information about the blocks, replicas, and nodes that contain them.


This command also displays a summary of the cluster, including the number of live and dead DataNodes, the number of blocks and under-replicated blocks, and the cluster’s total and remaining capacity. It also displays the general health of the file system, as well as information about the blocks, replicas, and nodes that contain them.

  • Write the command used to copy data from the local system onto HDFS?

The following command is used to copy data from the local system to HDFS in Hadoop:


hdfs dfs -put <local_source> <hdfs_destination>




<local_source>  is the path to the file or directory on the local system that you want to copy.

<hdfs_destination> is the HDFS path to which you want to replicate the file or directory.

For example, to copy a file named “data.txt” from the local system to the HDFS directory “/user/data,” use the following command:


hdfs dfs -put data.txt /user/data/


In addition, you can use the command


hadoop fs -copyFromLocal <local_source> <hdfs_destination>


to move data from the local system to HDFS.


It’s important to note that the -put command only copies a single file or directory; if you wish to copy numerous files or directories at once, use the -put -r command, which will recursively copy all files and directories in the local source.

  • Explain the purpose of the dfsadmin tool?

The dfsadmin tool is a command-line programme in Hadoop HDFS (Hadoop Distributed File System) that is used to administrate the HDFS cluster. The dfsadmin utility is used to execute numerous administration duties such as:


Checking the health of the HDFS cluster: The dfsadmin tool can be used to verify the overall health of the HDFS cluster, including the status of DataNodes, the number of blocks and under-replicated blocks, and the total and remaining capacity of the cluster.


Managing DataNodes: The dfsadmin utility can be used to manage DataNodes, such as starting and stopping DataNodes and examining the status of DataNodes in the cluster.


Managing replication: The dfsadmin utility can be used to manage HDFS data replication, such as adjusting the replication factor for files and directories and checking the replication status of cluster blocks.


Balancing the cluster: The dfsadmin tool can be used to balance data across DataNodes in a cluster, improving HDFS performance and reliability.


Safe mode management: The dfsadmin tool can be used to administer safe mode.

  • Explain the actions followed by a Jobtracker in Hadoop.

The JobTracker is a critical component of Hadoop’s MapReduce framework that manages and schedules MapReduce processes within a Hadoop cluster. The following are the primary functions of a JobTracker:


Job submission: The JobTracker accepts client job submissions and assigns them to the proper TaskTrackers for execution.


Job scheduling: A scheduling method is used by the JobTracker to determine which tasks should be done on which TaskTrackers. It makes scheduling decisions based on criteria such as data proximity, job dependencies, and cluster resources.


Task assignment: After a work is scheduled, the JobTracker allocates tasks to TaskTrackers for execution. The JobTracker also tracks the progress of each work and reschedules those that fail or are delayed.


Heartbeats: The JobTracker connects with TaskTrackers via heartbeats to check their status. TaskTrackers send heartbeats to the JobTracker to indicate their state, and the JobTracker uses this information to make scheduling decisions.


Job completion: When all of the tasks of a job have been successfully completed, the JobTracker recognises the job as completed and sends the final output to the client.


Failure and recovery: The JobTracker monitors the TaskTrackers, and the TaskTrackers communicate the heartbeat to the JobTracker. If any of the TaskTrackers fails, the JobTracker will redistribute the tasks that were executing on that TaskTracker to other TaskTrackers in the cluster.


Job Prioritization: Jobtracker additionally prioritises jobs based on user-specified or default priorities.

  • Explain the distributed Cache in MapReduce framework.

The Distributed Cache is a Hadoop MapReduce framework feature that provides for the efficient distribution of read-only data to TaskTrackers running MapReduce tasks. The distributed cache can be used to distribute huge, read-only files required by the mappers or reducers, such as lookup tables or reference data.


The following are the primary characteristics of the Distributed Cache:


Data distribution: The Distributed Cache sends the given files to the TaskTrackers running the job. This enables the mappers and reducers to access the files locally, which can enhance performance by lowering the amount of data read from HDFS.


Data replication: The Distributed Cache duplicates files across many TaskTrackers, improving fault tolerance and data availability.


Data access: The Distributed Cache allows mappers and reducers to access files that have been distributed to them. This is accomplished by employing an unique class known as the CacheFile, which allows files to be accessed as if they were local.


Data Eviction: Distributed cache also allows you to evict files that are no longer required by the job in order to free up space on the cluster.


Data management: The Distributed Cache also allows you to manage the files you’ve distributed, such as checking their status and eliminating items that are no longer needed.

  • List the actions that happen when a DataNode fails.

In Hadoop HDFS (Hadoop Distributed File System), the following things occur when a DataNode fails:


Heartbeat failure: The NameNode no longer receives heartbeats from the failed DataNode. This lets the NameNode know that the DataNode failed.


Block replication: The NameNode begins replicating the blocks kept on the downed DataNode to the other DataNodes in the cluster. In order to maintain the blocks’ replication factor and the availability of the data, this is done.


Block re-registration: With the remaining DataNodes in the cluster, the NameNode re-registers the blocks on the failing DataNode. The blocks are made available for reading and writing by doing this.


Block rebalancing: The NameNode initiates rebalancing the blocks among the cluster’s DataNodes. This is done to make sure that the blocks are distributed equally among the DataNodes and to enhance the cluster’s overall performance.


Block invalidation: The NameNode invalidates and flags as “under-replicated” or “corrupt” any blocks that were kept on the failed DataNode. In order to prevent reading or writing on the blocks, this is done.


Removing the Task Tracker: The JobTracker stops giving tasks to the TaskTracker that is currently operating on the failed DataNode.


Decommissioning a Node: When a DataNode is decommissioned, the NameNode removes it from the cluster and stops allocating new blocks to it.


Alerts and notifications may be provided to the cluster administrator in response to a DataNode failure so that the issue can be looked into and fixed.

  • What are the basic parameters of a mapper?

A mapper in Hadoop is an extension of the org.apache.hadoop.mapreduce.Mapper class. Overrides the “map” method in the Mapper class. A mapper function’s fundamental inputs are:


LongWritable key: This is the input key, which is ordinarily an offset into the input file represented by a long integer.


The input value, which is typically a line of text from the input file, is represented by the text value.


This object enables communication between the mapper and the rest of the Hadoop system, including writing output key-value pairs and status reporting.


The reducer receives the intermediate key-value pairs that the mapper function produces after processing the input key-value pairs.

  • Mention the main Configuration parameters that has to be specified by the user to run MapReduce.

To start MapReduce in Hadoop, the following configuration parameters must be given by the user:


fs.defaultFS: The HDFS file system URI that includes the host and port information for the namenode

mapreduce.framework.name: The framework name, which can be set to “local” for local execution or “yarn” for YARN.

The quantity of map tasks to execute for the job is specified by the mapreduce.job.maps parameter.

MapReduce.Job.Reduces: The quantity of reduce jobs that should be executed for the job.

The memory allotted for the map jobs is specified by the mapreduce.map.memory.mb property.

The memory allotted for the reduce tasks is specified by the mapreduce.reduce.memory.mb variable.

mapreduce.map.java.opts: The JVM settings to utilise for the map tasks.

MapReduce.Reduce.Java.Options: The JVM options to utilise for Reduce tasks.


Although there are additional parameters, these are the primary ones that must be given by the user in order to perform a MapReduce task in Hadoop.

  • Explain the Resilient Distributed Datasets in Spark.

The core data structure for distributed data processing in Apache Spark is known as resilient distributed datasets (RDDs). They are a set of elements that are fault-tolerant and capable of parallel processing. Since RDDs are immutable, their contents cannot be changed after they have been formed.


Data from the Hadoop Distributed File System (HDFS), local file systems, and other data sources can be used to construct RDDs. With the help of a number of high-level operations like map, filter, and reduce, they can be changed and processed. For quicker access, the outcomes of these operations can be cached in memory.


RDDs can automatically recover from node failures since they are resilient. This is accomplished by partitioning the RDD and storing numerous copies of the partitions throughout the cluster. The lost partitions can be recreated from the surviving copies in the event of a node failure.


Spark’s data processing capabilities are built on RDDs, which offer a quick and effective approach to handle distributed data in a fault-tolerant manner. Spark is able to process data significantly more quickly than Hadoop MapReduce thanks to the idea of splitting data into smaller parts and processing it in parallel.

  • Give a brief on how Spark is good at low latency workloads like graph processing and Machine Learning.

Several factors make Apache Spark suitable for low-latency tasks like machine learning and graph processing.


In-memory processing: Spark enables the caching of RDDs and DataFrames, which speeds up the computation of iterative algorithms used in machine learning and graph processing.


Lazy evaluation: Spark’s query optimizer employs a method known as lazy evaluation, delaying the execution of a query until the need for the final result arises. As a result, Spark can improve the query plan’s performance.


Spark offers specialised libraries like GraphX and MLlib for machine learning and graph processing, respectively. Implementing these workloads in Spark is simple since these libraries offer a high-level API for carrying out complicated operations on graph data and machine learning techniques.


Data locality: Spark enables data to be processed as close to where it is stored as feasible, which can lower network I/O and enhance speed.


In order to read and write data from them effectively and to take use of their security, scalability, and data governance features, Spark can also be linked with other big data technologies like the Hadoop ecosystem (HDFS, Hbase, and Hive).

  • What applications are supported by Apache Hive? 

The Hadoop Distributed File System provides the foundation for the data warehousing and SQL-like query language tool known as Apache Hive (HDFS). It supports the following applications primarily:


Data warehousing: Hive enables users to conduct data warehousing operations on huge datasets kept in HDFS, including data aggregation, data filtering, and data analysis.


Data modelling: Hive enables users to improve the storage and querying of huge datasets by supporting data modelling principles like dividing, bucketing, and external tables.


Hive supports the SQL-like query language known as HiveQL, which enables users to carry out complicated data analysis tasks using a syntax they are already familiar with.


Data integration: Hive enables the data warehouse to include data from several sources, including log files, text files, and other structured and semi-structured data types.


Business intelligence: Hive is used to support business intelligence tasks by giving data analysts a SQL-like interface via which they can run ad-hoc queries, create reports, and display data.


ETL: Data can be extracted, transformed, and loaded into a Hive data warehouse using Hive as part of the ETL process.


Machine learning: Hive may be connected with machine learning libraries such as Mahout and Spark MLlib, allowing data scientists to run advanced analytics on huge datasets.

  • Explain a metastore in Hive?

In Hive, a metastore is a service that maintains metadata in a relational database about the tables, partitions, and other Hive objects. Multiple users and programmes can access the same data about the Hive tables and partitions thanks to the metastore’s role as a central repository for metadata.


Several crucial elements make up the metastore:


Database: A relational database, such as MySQL, PostgreSQL, or Derby, houses the metadata information that is stored in the metastore.


Schema : Table names, column names, data types, and information about partitions are all examples of the metadata information that is stored in the metastore’s defined set of tables and columns, or schema.


Metastore Service: The HiveServer2 and the metastore service are both Java processes that operate on the same machine. It interacts with the database and gives users access to the metadata that is kept there.


Thrift API: The metastore service offers a Thrift API that enables users of its services, such as Hive and Pig, to interact with it and have access to the metadata kept in the database.


As it enables Hive to read and write data from diverse data sources and allows numerous users to share the same metadata, the metastore is essential to Hive’s design. Additionally, it enables management and organisation of the data in the Hive warehouse as well as HiveQL data queries.

  • Compare differences between Local Metastore and Remote Metastore

A metastore in Hive is a service that maintains metadata in a relational database about the tables, partitions, and other Hive objects. A remote metastore or a local metastore can both be used by Hive.


A local metastore and a remote metastore vary primarily in that they are:


Location: A local metastore keeps metadata in a nearby database, like Derby, and runs on the same system as the Hive client. A remote metastore, which operates on a different computer, keeps data in a remote database like MySQL or PostgreSQL.


Concurrent access is not supported by a local metastore because it is designed for just one user. A remote metastore is made for several users and allows for simultaneous access.


Scalability: A local metastore can only hold a certain amount of metadata and is not scaleable. The scalability and capacity of a remote metastore are greater.


Security: A local metastore’s local file system, which stores metadata, is less secure than a distant metastore. Remote metastore saves metadata in a remote database, which is more safe because it can be backed up and also makes advantage of other security features like encryption provided by the database.


Backup and recovery: Unlike a remote metastore, which can be backed up and recovered using the backup and recovery features of the remote database, a local metastore lacks any backup and recovery mechanisms.


In conclusion, a local metastore is made for a single user and is not scalable, whereas a remote metastore is made for many users and is more scalable and secure. The ability to leverage the remote database’s backup and recovery functionality is another benefit of a remote metastore.

  • Are Multiline Comments supported in Hive? Why?

Multi-line comments are not supported by Hive by default. In Hive, a single-line comment begins with the letters ‘–‘ and goes on to the end of the line.


Because HiveQL, the query language used by Hive, is based on SQL, which does not by default support multi-line comments, this is the case. In order to make learning and using Hive easier for people who are already familiar with SQL, HiveQL is created to be as similar to SQL as feasible.


However, you can comment multiple lines in a Hive script by using the /* */ syntax. You should be aware that this is not a standard Hive feature and that not all Hive versions or distributions will support it.


A Unix shell environment is frequently required to run Hive scripts because Hive is built on top of Hadoop and supports multi-line comments using the # sign. As a result, multi-line comments in Hive scripts are frequently made using shell script comments.


In conclusion, Hive does not natively support multi-line comments, but you can comment multiple lines in a Hive script by using the /* */ syntax. However, not all Hive distributions or versions are guaranteed to support it.

  • Why do we need to perform partitioning in Hive?

Hive uses partitioning to speed up queries on huge datasets by enabling the query to only scan the relevant section of the data as opposed to the complete dataset. When data is partitioned in Hive, subdirectories holding the information for individual partitions are created within the table’s directory on HDFS. Instead of scanning the entire database, the query can now only search the subfolder for the partition that holds the pertinent data. This can significantly lower the quantity of data that the query must read and process, enhancing its performance.

  • How can you restart NameNode and all the daemons in Hadoop?

You can use the next methods to restart the NameNode and every daemon in a Hadoop cluster:


Stop all DataNodes and the NameNode:


$ $HADOOP_HOME/sbin/stop-dfs.sh


The ResourceManager and NodeManagers must be stopped:


$ $HADOOP_HOME/sbin/stop-yarn.sh


Start all the DataNodes and the NameNode:


$ $HADOOP_HOME/sbin/start-dfs.sh


Launch the resource and node managers:


$ $HADOOP_HOME/sbin/start-yarn.sh


Note that you must substitute the exact path where Hadoop is installed for $HADOOP_HOME.


You can also use the commands $HADOOP_HOME/sbin/stop-all.sh  and $HADOOP_HOME/sbin/start-all.sh to stop and start all of the daemons, respectively.


It is advised to restart the NameNode during off-peak hours or when you have a backup of your data because doing so will make all of the HDFS data inaccessible.

  • How do you differentiate inner bag and outer bag in Pig.

A bag in Pig is a group of records or tuples that may include duplicate items. An outside bag holds additional bags, whereas an inner bag is one that is contained within another bag.


Think about the following Pig script, which defines the relation “A” with the two fields “id” and “inner _bag” as an example:


A = LOAD ‘data.txt’ AS (id: int, inner_bag: {t: (x: int, y: int)});


Because it is enclosed within the relation “A,” which is the outer bag in our illustration, “inner _bag” is an inner bag.


Another illustration is if relation B, which is the inner bag of connection A, is present:


A = LOAD ‘data.txt’ AS (id: int, inner_bag: {t: (x: int, y: int)});



The outside bag in this illustration is relation A, while the inside bag is relation B.


It’s vital to remember that inner bags can nest inside of other inner bags to form nested structures of bags. Each bag in a nested structure can be thought of as both an exterior bag and an inner bag of the bags that it contains.

  • If the source data gets updated every now and then, how will you synchronize the data in HDFS that is imported by Sqoop?

There are numerous methods for synchronising data in HDFS that has been imported by Sqoop:


Scheduled imports: To maintain the HDFS data up to date, you can plan Sqoop imports to occur at regular intervals, such as daily or monthly.


Sqoop enables incremental imports, which only import data that has been added or updated since the previous import. This can be accomplished by specifying the column to be checked for changes and the  –incremental parameter.


Hive or Hbase can be used to keep track of the most recently imported data in HDFS and use that data to perform incremental imports.


Using Apache NiFi: Apache NiFi is a robust data integration tool that can be used to automate data transfer and transformation, schedule data imports, and keep HDFS data up to date.


It’s vital to remember that the approach you choose will be determined by your use case’s specific requirements, such as the frequency of updates, the volume of data, and the complexity of the data.

  • Where is table data stored in Apache Hive by default?

By default, Apache Hive stores table data in the Hadoop Distributed File System (HDFS). When you build a table in Hive, the data for that table is saved in HDFS as files. The “location” property of the table, which may be supplied in the CREATE TABLE line or using the Hive web interface, specifies the location of these files. If the location attribute is not supplied, Hive will use the Hive configuration file’s default location (hive-site.xml). This is commonly set to the HDFS user directory, such as /user/hive/warehouse, although it can be assigned to any HDFS directory.

  • What is the default File format to import data using Apache sqoop?

Text files are the default file type for importing data into Apache Sqoop. Sqoop will create a collection of text files in the target HDFS directory for each table or query when importing data from a relational database to HDFS. Each file comprises a duplicate of the table or query data, one line per record, with fields separated by a delimiter. The comma (‘,’) is the default delimiter, but it can be modified using the  —fields-terminated-by option.


It’s also worth mentioning that Sqoop supports a variety of file formats, including Avro, SequenceFile, and Parquet. The  –as-<file format>option can be used to specify the file format. To import in Avro format, for example, use –as-avrodatafile, for sequence file format, use  –as-sequencefile and for Parquet file format, use –as-parquetfile.

  • What is the use of the -compress-codec parameter?

When importing or exporting data with Apache Sqoop, the -compress-codec argument specifies the compression codec to be used. Data files are compressed using compression codecs to save storage space and reduce network transfer time.


Sqoop will create a collection of text files in the target HDFS directory for each table or query when importing data from a relational database to HDFS. Sqoop does not compress these files by default, but you can provide a compression codec to use using the -compress-codec option. The data files in the target HDFS directory will be compressed as a result of this.


The -compress-codec parameter takes a compression codec class name, such as org.apache.hadoop.io.compress.GzipCodec, org.apache.hadoop.io.compress.SnappyCodec, or org.apache.hadoop.io.compress.BZip2Codec.


It is important to note that the codec class must be on the classpath of both the Sqoop client and the Hadoop cluster.

  • What is Apache Flume in Hadoop ?

Apache Flume is a distributed, dependable, and available service for collecting, aggregating, and transporting huge amounts of log data from various sources to a centralised data store such as HDFS, Hbase, or Solr.


Flume is highly adaptable and expandable, and it can collect data from a variety of sources such as log files, social media feeds, and network traffic. It also allows for the flexible routing, transformation, and processing of data as it flows through the pipeline.


Flume agents, which run on the hosts from which the data originates, collect the data. These agents are set up to gather data from various sources and then deliver it to one or more sinks, which are in charge of storing it in the centralised data store.


Flume also has a failover and recovery mechanism to ensure that data is not lost in the event of an agent or sink failure.


Flume is a sophisticated tool for gathering, aggregating, and transferring massive amounts of data from various sources to a centralised data storage in the Hadoop ecosystem. It enables data to be handled in a dependable, efficient, and highly configurable manner.

  • Explain the architecture of Flume.

Apache Flume’s architecture is based on a simple and flexible pipeline concept composed of three major components:


Sources: The sources are in charge of gathering data from various external sources such as log files, network traffic, and social media feeds. They are set up to listen for incoming data and send it to the next component in the pipeline.


Channels: The channels are in charge of buffering and keeping data as it goes through the pipeline. They serve as a temporary storage place between the sources and sinks. Data is written to the channels by the sources and read by the sinks.


Sinks: The sinks are in charge of providing data to the end destination, which can be HDFS, Hbase, or Solr. They take data from the channels and send it to the destination.


The aforementioned three components are linked in a pipeline, and data travels through the pipeline in the following order: source -> channel -> sink.


Flume features a fourth component called a “Interceptor” that can be used to pre-process data as it moves through the pipeline in addition to these three primary components.


It’s important to note that a single Flume agent can support numerous sources, channels, and sinks, allowing for more sophisticated data flows. Furthermore, additional Flume agents can be linked to build a bigger data collection and transmission system.


Overall, Flume’s architecture is intended to be simple, flexible, and extensible, allowing for easy integration with a wide range of data sources and destinations while also providing a dependable and efficient mechanism for collecting, aggregating, and moving large amounts of data in the Hadoop ecosystem.

  • Mention the consequences of Distributed Applications.

Hadoop distributed applications can have a number of implications, including:


Scalability: Hadoop allows for the distributed processing of massive data sets over several workstations, considerably increasing the application’s scalability.


Fault tolerance: Because of Hadoop’s distributed architecture and data replication across numerous nodes, it can provide a high level of fault tolerance, lowering the chance of data loss in the case of a node failure.


Data locality: By storing data on the same nodes where it is processed, Hadoop can increase application performance by decreasing the requirement for massive amounts of data to be transferred over the network.


Complexity: Distributed systems can be difficult to design, build, and maintain, and adding more nodes can make debugging and troubleshooting more difficult.


High availability: Hadoop’s distributed architecture enables high availability of data and applications, which means that the application can continue to function even if one or more nodes fail.


Data security: Because the data is spread over numerous nodes, it is more safe than if it were held on a single machine.


Advanced interview questions : 

  • What platform and Java version are required to run Hadoop?

Hadoop runs on a Java Virtual Machine (JVM). Java 8 is the minimum necessary version to operate Hadoop. However, for improved efficiency and security, it is advised that you use the most recent version of Java. Hadoop is compatible with both Oracle Java and OpenJDK.


Hadoop may run on a variety of operating systems, including Windows, Linux, and macOS. However, it is created and tested mostly on Linux, and the majority of Hadoop distributions are bundled for Linux. As a result, it is suggested that Hadoop be run on a Linux operating system.


It should also be mentioned that because Hadoop is a distributed system, it can run on a cluster of machines that may run a variety of operating systems and hardware architectures.

  • What kind of Hardware is best for Hadoop?

The hardware requirements for Hadoop depend on the amount and complexity of the data set as well as the applications that will run on the cluster. However, the following are some general criteria for selecting hardware for a Hadoop cluster:


CPU: Because Hadoop is a data-intensive application, having a large number of CPU cores is advantageous. High-performance servers with numerous CPU sockets and cores are ideal for Hadoop.


Memory: In order to store data and conduct activities, Hadoop requires a considerable quantity of memory. It is suggested that each node have at least 16GB of RAM, and more for bigger clusters.


Storage: Because Hadoop uses a distributed file system to store data, each node in the cluster must have a vast quantity of storage. It is suggested that each node have at least 1TB of storage, and bigger clusters should have even more.


Network : Hadoop relies on a quick and dependable network to transport data between nodes. It is suggested that the network be at least 10 Gbps, and even more for bigger clusters.


Hardware balance: The cluster’s CPU, memory, and storage should be balanced so that all nodes may contribute to the cluster’s processing power.


It’s also worth noting that Hadoop supports the use of cloud-based infrastructure, such as AWS, Azure, and GCP, which allows for the flexibility to scale up and down resources based on demand.

  • What are the most common input formats defined in Hadoop?

Hadoop defines a number of input formats for reading data from various sources. The following are the most popular input formats:


TextInputFormat: This is Hadoop’s default input format. It reads data as plain text and divides it into lines. Each line is considered a record and is provided to the mapper function.


KeyValueTextInputFormat: This input format reads data as key-value pairs, with the keys and values separated by a delimiter. It is widely used to read data from CSV or TSV files.


The SequenceFileInputFormat is used to read data from Hadoop’s native binary format, SequenceFile. It is used to store massive amounts of binary data like photos, audio, and video.


NLineInputFormat: This input format reads data in the form of lines and divides it into N lines at a time, where N is a parameter. It can be used to process big files that cannot be divided into smaller chunks.


MultipleInputs: This class enables the user to use several input formats for distinct HDFS folders.


WholeFileInputFormat: Reads an entire file as a single record and is useful for processing huge files that cannot be divided into smaller chunks.


These are some of the most common input formats in Hadoop, however there are more, such as RCFileInputFormat, AvroKeyInputFormat, and others. Depending on the application, different input formats may be more suited to specific types of data or workloads.

  • Give the use of the bootstrap panel.

The bootstrap panel in Hadoop is not a distinct feature or component of the Hadoop ecosystem. Bootstrap is a popular front-end web development framework that is frequently used to generate responsive and mobile-friendly web pages. It includes CSS and JavaScript classes for building standard web elements like navigation bars, forms, and buttons.


The bootstrap panel is a bootstrap framework class that is used to build a container for grouping information. It can be used to make a visually separate area on a webpage, as well as to organise other elements like headings, paragraphs, photos, or tables.


Someone could use bootstrap to build a web interface for monitoring or administering a Hadoop cluster. However, bootstrap is not a Hadoop component and is not used in the core of the Hadoop ecosystem.

  • What is the purpose of button groups?

Button groups are not a distinct feature or component of the Hadoop ecosystem. Bootstrap, a front-end framework for web development, provides a class called Button Groups. Button groups in Bootstrap are used to group a sequence of buttons together in a single line. The button group class allows you to construct a horizontal or vertical group of buttons that are all aligned and have the same size.


Button groups can be used to generate a set of options from which the user can choose, such as radio buttons or checkboxes. A button group, for example, could be used to generate a series of alternatives for filtering a data set, such as by date range, data type, or location.


In this situation, button groups can be used to generate a collection of alternatives for doing different actions on the data or the cluster. However, Bootstrap is not a component of Hadoop and is not used in the core of the Hadoop ecosystem.

  • Name the various types of lists supported by Bootstrap.

Lists are a common approach to present a sequence of items in a vertical or horizontal arrangement in Bootstrap. Bootstrap supports a variety of list types, including:


Unordered list: This is a simple list with a bullet point before each item. It is made with the ul element.


Ordered list: Like an unordered list, each item is preceded by a number or letter. It is made with the ol element.


A definition list is a type of list that is used to define terms and their meanings. It is built with the dl element, dt elements for terms, and dd elements for definitions.


Description list: This is a sort of list that is used to provide multiple terms and their descriptions in a formatted manner. It is built with the dl element, including dt elements for words and dd elements for descriptions.


Inline list: A list in which the items are shown horizontally rather than vertically. It’s made with the ul or ol element and the.list-inline class.


Linked list: A list in which each item is a hyperlink. It is constructed by combining the ul or ol element with the.list-unstyled and an elements.


It should be noted that Bootstrap is a front-end framework that is not part of the Hadoop ecosystem. Bootstrap is used to construct web-based interfaces and is not tied to the Hadoop environment.

  • What is InputSplit in Hadoop? Explain.

An InputSplit in Hadoop is a logical representation of a subset of input data that is assigned to a single mapper for processing. The InputFormat class is in charge of generating InputSplits for a MapReduce task and defining how the input data will be divided into smaller chunks.


When you execute a MapReduce job, Hadoop divides the incoming data into one or more InputSplits and sends each split to a different mapper task. The mapper job analyses the split data and returns intermediate key-value pairs as output.


The InputSplit class is an abstract class that can be extended by multiple InputFormat classes to generate their own specialised forms of InputSplits. The FileInputFormat class, for example, generates FileSplits that represent a single HDFS block of the input file, whereas the TextInputFormat class generates LineRecordReaders that read lines of text from the input file.


The InputSplit is used to determine data locality; data that is closest to the mapper job is assigned to it. This enhances overall task performance by decreasing data transfer over the network.


The InputSplit also holds information about the split’s location, such as the hostnames of the nodes that store the data, so that the Task Tracker can schedule mapper tasks on the same node as the data, which is referred to as data locality.

  • What is TextInputFormat?

TextInputFormat is a built-in Hadoop input format used to read plain text files as input for a MapReduce job. The org.apache.hadoop.mapreduce.lib.input package provides it as the default input format in Hadoop.


The TextInputFormat class reads plain text input and divides it into lines. Each line is considered a record, and the mapper function processes each record individually. Each record’s key represents the byte offset of the line in the input file, and the value is the line’s text.


The TextInputFormat can be used with any mapper class to process text data of any size. When dealing with huge text files, however, it has some restrictions because it pulls the full file into memory to parse it.


Set the input format class in the job settings using the Job.setInputFormatClass() function to utilise the TextInputFormat class. TextInputFormat can also be used in conjunction with other input format classes that extend it, such as NLineInputFormat, KeyValueTextInputFormat, and others.

  • What is the SequenceFileInputFormat in Hadoop?

SequenceFileInputFormat is a built-in input format in Hadoop that is used to read SequenceFile format files as input for a MapReduce job. The SequenceFile binary format is intended for storing vast amounts of binary data, such as photos, audio, or video. It is a columnar format designed for quickly reading vast amounts of data.


The SequenceFileInputFormat class reads input data as a sequence of binary key-value pairs, where the key is a Writable instance and the value is also a Writable instance. Each key-value pair is processed separately by the mapper function.


The SequenceFileInputFormat class can be used to process huge binary data sets and is especially useful for material that does not lend itself well to text-based forms. It is also handy for material that has already been saved in the SequenceFile format because it allows the data to be read directly without conversion.


Set the input format class in the job setup using the Job.setInputFormatClass() function to utilise the SequenceFileInputFormat class.


It should be noted that the SequenceFile format is not the most efficient storage format for huge datasets; it is no longer extensively used and has been supplanted by other formats such as Avro, Parquet, and ORC.

  • How many InputSplits is made by a Hadoop Framework?

The number of InputSplits generated by the Hadoop framework is determined on the input data and the job parameters.


The InputFormat class is in charge of generating InputSplits for a MapReduce task and defining how the input data will be divided into smaller chunks. The number of InputSplits is defined by the block size of the input data, which in HDFS is typically 128MB or 256MB per block.


The FileInputFormat class, which serves as the foundation for most Hadoop input formats, generates one InputSplit for each block of the input file. This indicates that if the input file is lower than a block size, only one InputSplit will be created, but if the input file is larger, many InputSplits will be created, one for each block.


Other factors like as cluster size, number of mapper processes, available memory, and data proximity can all have an impact on the number of InputSplits. The task configuration can also be used to set the number of InputSplits by utilising the mapred.min.split.size and mapred.max.split.size attributes.


By using the InputFormat, you may additionally specify the number of InputSplits based on the input data.


The getSplits() method takes the JobContext object and produces an array of InputSplits that may be utilised in the MapReduce process.

  • What is the use of RecordReader in Hadoop?

A RecordReader class in Hadoop is responsible for reading the input data for a MapReduce job and transforming it into key-value pairs that the mapper function can handle. The RecordReader class works in tandem with the InputFormat class, which is in charge of constructing InputSplits for the job.


The RecordReader class reads input data from the InputSplit and turns it into key-value pairs, where the key is a LongWritable instance and the value is a Text instance. The key reflects the record’s position in the input file, while the value represents the record’s contents.


Other helpful methods provided by the RecordReader class are getProgress(), which returns the record reader’s progress as a float between 0.0 and 1.0, and nextKeyValue(), which returns true if a new key-value pair was read and false otherwise.


The RecordReader class is an abstract class that may be extended by different input formats to construct their own specialised forms of record readers. The TextInputFormat class, for example, employs the LineRecordReader class to read each line of the input file as a record, whereas the SequenceFileInputFormat class employs the SequenceFileRecordReader class to read binary key-value pairs from the input file.


The RecordReader is an essential component of Hadoop’s data processing pipeline; it is in charge of receiving input data and translating it into a format that the mapper can readily process.

  • What is WebDAV in Hadoop?

WebDAV (Web Distributed Authoring and Versioning) is a protocol that allows users to use a web browser to view, manage, and edit files on a remote server. WebDAV is a Hadoop feature that allows users to utilise the WebDAV protocol to access data stored in the Hadoop Distributed File System (HDFS).


WebDAV is implemented in Hadoop by using the Hadoop Distributed File System (HDFS) WebDAV Servlet, which is a servlet that runs on the Hadoop Namenode and allows users to access HDFS data using the WebDAV protocol. This servlet can be set to run on a given port and accessed by any WebDAV client.


WebDAV in Hadoop allows users to access HDFS data in a manner similar to that of a local file system, but it also adds features such as the ability to create, modify, and remove files and directories, as well as manage permissions and access controls.


WebDAV is not extensively used in Hadoop since it is less performant than alternative means of accessing data in HDFS, such as using the Hadoop command-line tools or the HDFS API. It can, however, be useful in some scenarios, such as when users need to view HDFS data from a web browser or combine HDFS data with other web-based applications.

  • What is Sqoop in Hadoop?

Sqoop is a Hadoop ecosystem utility for transferring data between Hadoop and structured data storage such as relational databases. It enables data import and export between Hadoop and structured data stores like MySQL, Oracle, and Postgres, among others. It can also move data between Hadoop and NoSQL databases like MongoDB and Cassandra.


Sqoop transfers data between Hadoop and structured data repositories using MapReduce. It may import data from a structured data store into Hadoop Distributed File System (HDFS) or Hive and export data from HDFS or Hive back to a structured data store.


Sqoop includes a command-line interface (CLI) and a set of APIs for data transport. It also supports a number of data formats, including Avro, Parquet, and SequenceFile.


Sqoop supports incremental imports and exports, and it may also be used for data warehousing and data mining, data integration, and transferring data from structured data stores to Hadoop for additional processing and analysis.


Sqoop is a critical tool in the Hadoop ecosystem; it lets enterprises to effortlessly transport data between structured data storage and Hadoop, allowing them to fully leverage Hadoop’s capability for big data processing and analysis.

  • Define TaskTracker.

A TaskTracker in Hadoop is a node in a Hadoop cluster that executes task instances on behalf of the JobTracker. The TaskTracker is in charge of running the map and reduce tasks allocated to it by the JobTracker, as well as communicating the progress of the tasks to the JobTracker.


When a TaskTracker is assigned a task, the TaskTracker starts a new JVM to run the task. The task reads the input data, processes it, and outputs it. The TaskTracker monitors the task, and if the task fails or is taking too long to complete, it will notify the JobTracker and request a new task.


Each TaskTracker is assigned a fixed amount of memory and CPU resources, which the JobTracker utilises to assign jobs to TaskTrackers. Data locality information is also used by the JobTracker to assign jobs to TaskTrackers that are operating on the same node as the input data, which can increase job performance.


The TaskTracker additionally transmits heartbeat signals to the JobTracker to notify it that it is still alive; the heartbeat signals include include the status of the running tasks, available resources, and task progress.


The TaskTracker is a crucial component in the Hadoop ecosystem; it is responsible for task execution as well as data localization, which enhances overall job performance.

  • What happens when a data node fails?

When a Hadoop data node fails, the Hadoop Distributed File System (HDFS) takes the following procedures to assure data availability and integrity:


The failure of the data node is detected by the NameNode, the master node in HDFS. It designates the data node as dead and no longer accepts new requests from it.


The NameNode replicates data from the failed data node to the other data nodes in the cluster. This is done to ensure that the data is replicated at least once, where replication is a configuration value that is set when the cluster is established.


The NameNode updates its information to reflect the replicas’ new location. When clients request data, this metadata is kept in memory and utilised to determine the position of the data blocks.


The NameNode also sends a block report to the failed data node’s replicas, allowing the replicas to update their metadata and become aware of the replicas’ new location.


The NameNode also schedules the re-replication of any under-replicated blocks, or blocks with fewer replicas than the replication factor, to other data nodes in the cluster to assure data availability.


The NameNode will notify clients who requested data from the failed data node to retry the request to another data node.


In summary, when a data node fails, the HDFS NameNode detects it and takes action to maintain data availability and integrity by duplicating the data, updating the metadata, and scheduling re-replication of any under-replicated blocks to other data nodes in the cluster.

  • What is Hadoop Streaming?

Hadoop Streaming is a Hadoop feature that allows users to utilise any executable in a MapReduce job as a mapper and/or reducer. It allows you to run non-Java code as well as any programming language that can read from and write to standard input, such as Python, Perl, R, and many others.


Hadoop Streaming communicates between the Hadoop MapReduce framework and external executables via the Unix pipes method. It turns the incoming data into a series of key-value pairs and pipes it to the mapper executable’s standard input, then takes the mapper’s output, also key-value pairs, and uses it as input for the reduction executable.


Hadoop Streaming can handle data in a variety of formats, including text files, binary files, and XML files. It also enables users to develop custom mapper and reducer code in any language that can read from and write to standard input and output.


Hadoop Streaming is extremely beneficial when you need to apply custom logic that is not available in Java or when you need to utilise a library that is not available in the Java ecosystem. It also enables customers to reuse their existing codebase and avoid rewriting code in Java.


Hadoop Streaming is included in the Hadoop distribution and can be used by specifying the executable mapper and reducer in the job configuration using the -inputformat, -outputformat, -mapper, and -reducer command-line arguments.

  • What is a combiner in Hadoop?

A combiner, sometimes known as a semi-reducer, is a Hadoop function that conducts a local reduction operation on the mapper function’s output. The combiner function, which runs on the same node as the mapper function, is used to reduce the amount of data that must be transmitted over the network to the reduction function.


The combiner function takes the intermediate key-value pairs generated by the mapper function as input and performs the same reduce operation as the reducer function, but on a smaller scale. The combiner function’s output is also a set of key-value pairs that serve as input to the reducer function.


The combiner function is optional and is not guaranteed to be executed, although it is commonly used when the reducer function is more expensive than the combiner function and the mapper function output is huge.


The combiner function is frequently used to conduct simple aggregate operations on the output of the mapper function, such as sum, count, or average, but it can also be used to execute more complicated operations.


To utilise a combiner in Hadoop, use the Job.setCombinerClass() method to specify it in the job settings, and the class you specify must implement the Reducer interface.

  • What are the network requirements for using Hadoop?

Hadoop is a distributed computing system that communicates with its numerous components via a network. The particular network requirements for using Hadoop will vary depending on the size and complexity of the cluster, however the following are some common requirements:


High-speed and low-latency network: Because Hadoop nodes must regularly communicate with one another, a high-speed and low-latency network is critical for optimum performance. For large clusters, gigabit Ethernet or 10-gigabit Ethernet is often suggested.


Network availability: Hadoop nodes must always be able to communicate with one another, therefore the network must be stable and available. A network failure can cause a job to fail or data to be lost, so having a redundant network infrastructure is critical.


Network security: Hadoop nodes must be able to connect securely with one another, thus the network should be outfitted with proper security mechanisms such as firewalls, virtual private networks (VPNs), and intrusion detection systems.


Network segmentation: Because Hadoop clusters often include numerous sorts of nodes, such as master nodes, worker nodes, and client nodes, it is critical to segment the network in order to govern and manage traffic between different types of nodes.


Network bandwidth: Because Hadoop is a data-intensive system, it requires a network with the bandwidth to move massive amounts of data between nodes. This is especially crucial when data is being transported between racks or data centres.


Network topology: Hadoop is designed to function well with a range of network topologies, although it’s usually better to select a topology that reduces the number of hops between nodes; this will help to reduce network latency and increase cluster performance.

  •  Is it necessary to know Java to learn Hadoop?

Java is the primary programming language used in Hadoop, and the majority of Hadoop’s built-in functionality and libraries are written in Java. However, knowing Java is not required to learn Hadoop because there are alternative tools and libraries that allow the use of other programming languages like as Python, R, Perl, and many others.


Knowing Java will help you understand the inner workings of Hadoop and how it interacts with the various components, as well as enabling you to build custom code as needed, but it is not required to learn and operate with Hadoop.


To summarise, knowing Java is not required to learn Hadoop, but it will make it much easier to comprehend the system’s inner workings and build custom code when necessary.

  • How to debug Hadoop code?

Because of the distributed nature of the system, debugging Hadoop code can be difficult, however there are numerous ways that can be used:


Logging: Hadoop includes a logging method for logging messages from the mapper and reducer functions. These log messages can be used to track task progress and diagnose problems.


Counters: Hadoop has a system for counting the number of occurrences of various events in the mapper and reducer functions; these counters can be used to measure task progress and detect problems.


Remote debugging: Java provides for remote application debugging, which might be handy for troubleshooting Hadoop code. An IDE such as Eclipse can connect to a running Hadoop task and debug it.


Unit testing: Hadoop code may be tested using unit tests; this is an effective method for testing code and catching errors before they are deployed in the Hadoop cluster.


Profiling: Hadoop code can be profiled to find performance bottlenecks and troubleshoot faults using tools such as JVisualVM, Yourkit, and others.


Monitoring: Hadoop includes monitoring tools such as the Hadoop JobTracker and Hadoop TaskTracker web interfaces, which can be used to track the job’s progress, task status, and resource utilisation.

  • Is it possible to provide multiple inputs to Hadoop? If yes, explain.

Yes, many inputs can be provided to Hadoop. There are various options for accomplishing this:


Using multiple input pathways: The Hadoop MapReduce framework allows you to provide several input paths in the job setup, which can point to different HDFS directories or file systems. The data from all of the given input pathways will then be processed by the mapper function.


Using a CombineFileInputFormat: The CombineFileInputFormat class allows you to break big input files into smaller portions that the mapper function can process. This can be useful when you have a large number of small files that you want to process together.


Using a MultiFileInputFormat: The MultiFileInputFormat class allows you to specify several input files in a single job; the mapper function will then process data from all of the supplied input files.


Using a MultipleInputs class: The MultipleInputs class allows you to provide different input formats and mappers for separate input paths, which might be beneficial when you have different forms of input data that require different processing.


Using a ChainMapper and a ChainReducer: The ChainMapper and ChainReducer classes enable you to define several mappers and reducers in a single job, which is handy when you have a complex data processing pipeline that requires numerous stages of map and reduce operations.


These are some of the methods that can be used to supply various inputs to Hadoop; the method used will depend on the unique use case and job requirements.

  • What commands are used to see all jobs running in the Hadoop cluster and kill a job in LINUX?

There are various command-line tools available for viewing and managing jobs on a Hadoop cluster. These commands are commonly run from the command line of a system running the Hadoop client software.


You may use the following command to see all tasks running on a Hadoop cluster:


hadoop job -list


This command displays a list of all running and completed jobs on the cluster, including the job ID, job name, and the job’s current state.


You can use the following command to view the details of a given job:


hadoop job -status <job_id>


This command will display specific information about the job, such as the job setup, job progress, and job counters.


To terminate a task running on a Hadoop cluster, execute the following command:


hadoop job -kill <job_id>


This command will terminate the specified job and free any resources that it was using.


It’s important to note that terminating a task while it’s underway can result in data loss or incomplete data, so use this command with caution.


Furthermore, if you are operating a cluster managed by an orchestration tool such as YARN or Mesos, you may need to inspect and manage jobs on the cluster using the respective command-line tools or web interfaces provided by these platforms.

  • Is it necessary to write jobs for Hadoop in the Java language?

Java is the primary programming language used in Hadoop, and the majority of Hadoop’s built-in functionality and libraries are written in Java. As a result, many Hadoop jobs are written in Java; however, writing Hadoop tasks in Java is not necessarily necessary.


Hadoop has numerous non-Java code execution alternatives, including Hadoop Streaming, which allows you to utilise any executable as a mapper or reducer in a MapReduce operation. This means that any programming language that can read from standard input and write to standard output, such as Python, Perl, R, and many more, can be used.


There are also libraries, such as Pig and Hive, that allow you to execute data analysis on Hadoop using a SQL-like language without knowing Java.


Furthermore, several languages offer Hadoop libraries and modules, such as Pydoop and Rdoop for Python and R, respectively. These libraries enable you to construct MapReduce tasks in these languages, which is useful if you already have code written in these languages.


In summary, while Java is the primary language used in Hadoop, it is not necessarily necessary to develop Hadoop jobs in Java because Hadoop includes various options for running non-Java code, including Hadoop Streaming, Pig and Hive, as well as libraries for other languages.


In this article, we have covered a comprehensive list of Hadoop interview questions and provided detailed answers to help you prepare for your next big data interview. Hadoop is a widely used framework for distributed processing of large datasets, and having a strong understanding of its concepts and components is crucial for success in the field of big data. By familiarizing yourself with these interview questions, you can gain confidence and showcase your expertise in Hadoop’s core functionalities such as MapReduce and HDFS. Remember to practice these questions and tailor your answers to your own experiences and projects, ensuring you are well-prepared for any Hadoop interview that comes your way. Good luck!


Leave a Reply

Your email address will not be published. Required fields are marked *