Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Hadoop 2.x Administration Cookbook
Hadoop 2.x Administration Cookbook

Hadoop 2.x Administration Cookbook: Administer and maintain large Apache Hadoop clusters

Arrow left icon
Profile Icon Aman Singh
Arrow right icon
zł39.99 zł177.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.5 (2 Ratings)
eBook May 2017 348 pages 1st Edition
eBook
zł39.99 zł177.99
Paperback
zł221.99
Subscription
Free Trial
Arrow left icon
Profile Icon Aman Singh
Arrow right icon
zł39.99 zł177.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.5 (2 Ratings)
eBook May 2017 348 pages 1st Edition
eBook
zł39.99 zł177.99
Paperback
zł221.99
Subscription
Free Trial
eBook
zł39.99 zł177.99
Paperback
zł221.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Hadoop 2.x Administration Cookbook

Chapter 2. Maintaining Hadoop Cluster HDFS

In this chapter, we will cover the following recipes:

  • Configuring HDFS block size
  • Setting up Namenode metadata location
  • Loading data into HDFS
  • Configuring HDFS replication
  • HDFS balancer
  • Quota configuration
  • HDFS health and FSCK
  • Configuring rack awareness
  • Recycle or trash bin configuration
  • Distcp usage
  • Controlling block report storm
  • Configuring Datanode heartbeat

Introduction

In this chapter, we will take a look at the storage layer, which is HDFS, and how it can be configured for storing data. It is important to ensure the good health of this distributed filesystem, and make sure that the data it contains is available, even in the case of failures. In this chapter, we will take a look at the replication, quota setup, and balanced distribution of data across nodes, as well as covering recipes on rack awareness and heartbeat for communication with the master.

The recipes in this chapter assume that you already have a running cluster and have completed the steps given in Chapter 1, Hadoop Architecture and Deployment.

Note

While the recipes in this chapter will give you an overview of a typical configuration, we encourage you to adapt this proposal according to your needs. The block size plays an important role in the performance and the amount of data that is worked on by a mapper. It is good practice to set up passphrase less access between nodes,...

Configuring HDFS block size

Getting ready

To step through the recipes in this chapter, make sure you have completed the recipes in Chapter 1, Hadoop Architecture and Deployment or at least understand the basic Hadoop cluster setup.

How to do it...

  1. ssh to the master node, which is Namenode, and navigate to the directory where Hadoop is installed. In the previous chapter, Hadoop was installed at /opt/cluster/hadoop:
    $ ssh root@10.0.0.4
    
  2. Change to the Hadoop user, or any other user that is running Hadoop, by using the following:
    $ sudo su - hadoop
    
  3. Edit the hdfs-site.xml file and modify the parameter to reflect the changes, as shown in the following screenshot:
    How to do it...
  4. dfs.blocksize is the parameter that decides on the value of the HDFS block size. The unit is bytes and the default value is 64 MB in Hadoop 1 and 128 MB in Hadoop 2. The block size can be configured according to the need.
  5. Once the changes are made to hdfs-site.xml, copy the file across all nodes in the cluster.
  6. Then restart the Namenode and datanode...

Setting up Namenode metadata location

The most critical component of Hadoop is Namenode, and it is important to safeguard the information it stores. It stores metadata, which is a combination of namespace and inode structure.

All the steps are to be performed as the hadoop user. It is expected that the user has gone through Chapter 1, Hadoop Architecture and Deployment and understands the uses and function of Namenode.

Getting ready

You are going to need a preinstalled Hadoop as discussed in Chapter 1, Hadoop Architecture and Deployment. In the following recipes, we will configure the parameters for a copy of Hadoop that is already installed.

How to do it...

  1. ssh to the Namenode, which in this case is nn1.cluster1.com.
  2. Navigate to the /opt/cluster/hadoop/etc/hadoop directory. This is the directory where we installed Hadoop in the first chapter. If the user has installed it at a different location, then navigate to this directory.
  3. Configure the dfs.namenode.name.dir parameter, which defines the...

Loading data in HDFS

It is important to make sure that the cluster is working fine and the user can perform file operations on the cluster.

Getting ready

Log in to any of the nodes in the cluster. It's best to use the edge node, as stated in Chapter 1, Hadoop Architecture and Deployment, and switch to user hadoop.

Create a simple text file named file1.txt using any of your favorite text editors, and write some content in it.

How to do it...

  1. Connect to the client1.cluster1.com edge node and switch to the hadoop user.
  2. Copy the file1.txt file to HDFS, as shown in the following screenshot:
    How to do it...
  3. The user can check for the status of a file, as shown in the following screenshot:
    How to do it...
  4. The user can make sure that the file exists and its type is correct, as shown in the following screenshot. The user can execute the commands to see the sub options:
    $ hadoop fs (and hit enter to see the options)
    

How it works...

Steps 2 and 3 create a simple text file on the local filesystem and then copy it to HDFS to make sure...

Configuring HDFS replication

For redundancy, it is important to have multiple copies of data. In HDFS, this is achieved by placing copies of blocks on different nodes. By default, the replication factor is 3, which means that for each block written to HDFS, there will be three copies in total on the nodes in the cluster.

It is important to make sure that the cluster is working fine and the user can perform file operations on the cluster.

Getting ready

Log in to any of the nodes in the cluster. It is best to use the edge node, as stated in Chapter 1, and switch to the user hadoop.

Create a simple text file named file1.txt using any of your favorite text editors, and write some content in it.

How to do it...

  1. ssh to the Namenode, which in this case is nn1.cluster1.com, and switch to user hadoop.
  2. Navigate to the /opt/cluster/hadoop/etc/hadoop directory. This is the directory where we installed Hadoop in Chapter 1, Hadoop Architecture and Deployment. If the user has installed it at a different location...

HDFS balancer

In a long-running cluster, there might be unequal distribution of data across Datanodes. This could be due to failures of nodes or the addition of nodes to the cluster.

To make sure that the data is equally distributed across Datanodes, it is important to use Hadoop balancer to redistribute the blocks.

Getting ready

For this recipe, you will again use the same node on which we have already configured Namenode.

All operations will be done by user hadoop.

How to do it...

  1. Log in the nn1.cluster1.com node and change to user hadoop.
  2. Execute the balancer command as shown in the following screenshot:
    How to do it...
  3. By default, the balancer threshold is set to 10%, but we can change it, as shown in the following screenshot:
    How to do it...

How it works...

The balancer threshold defines the percentage of cluster disk space utilized, compared to the nodes in the cluster. For example, let's say we have 10 Datanodes in the cluster, with each having 100 GB of disk storage totaling to about 1 TB.

So, when we say the threshold...

Introduction


In this chapter, we will take a look at the storage layer, which is HDFS, and how it can be configured for storing data. It is important to ensure the good health of this distributed filesystem, and make sure that the data it contains is available, even in the case of failures. In this chapter, we will take a look at the replication, quota setup, and balanced distribution of data across nodes, as well as covering recipes on rack awareness and heartbeat for communication with the master.

The recipes in this chapter assume that you already have a running cluster and have completed the steps given in Chapter 1, Hadoop Architecture and Deployment.

Note

While the recipes in this chapter will give you an overview of a typical configuration, we encourage you to adapt this proposal according to your needs. The block size plays an important role in the performance and the amount of data that is worked on by a mapper. It is good practice to set up passphrase less access between nodes, so...

Configuring HDFS block size


Getting ready

To step through the recipes in this chapter, make sure you have completed the recipes in Chapter 1, Hadoop Architecture and Deployment or at least understand the basic Hadoop cluster setup.

How to do it...

  1. ssh to the master node, which is Namenode, and navigate to the directory where Hadoop is installed. In the previous chapter, Hadoop was installed at /opt/cluster/hadoop:

    $ ssh root@10.0.0.4
    
  2. Change to the Hadoop user, or any other user that is running Hadoop, by using the following:

    $ sudo su - hadoop
    
  3. Edit the hdfs-site.xml file and modify the parameter to reflect the changes, as shown in the following screenshot:

  4. dfs.blocksize is the parameter that decides on the value of the HDFS block size. The unit is bytes and the default value is 64 MB in Hadoop 1 and 128 MB in Hadoop 2. The block size can be configured according to the need.

  5. Once the changes are made to hdfs-site.xml, copy the file across all nodes in the cluster.

  6. Then restart the Namenode and...

Setting up Namenode metadata location


The most critical component of Hadoop is Namenode, and it is important to safeguard the information it stores. It stores metadata, which is a combination of namespace and inode structure.

All the steps are to be performed as the hadoop user. It is expected that the user has gone through Chapter 1, Hadoop Architecture and Deployment and understands the uses and function of Namenode.

Getting ready

You are going to need a preinstalled Hadoop as discussed in Chapter 1, Hadoop Architecture and Deployment. In the following recipes, we will configure the parameters for a copy of Hadoop that is already installed.

How to do it...

  1. ssh to the Namenode, which in this case is nn1.cluster1.com.

  2. Navigate to the /opt/cluster/hadoop/etc/hadoop directory. This is the directory where we installed Hadoop in the first chapter. If the user has installed it at a different location, then navigate to this directory.

  3. Configure the dfs.namenode.name.dir parameter, which defines the...

Loading data in HDFS


It is important to make sure that the cluster is working fine and the user can perform file operations on the cluster.

Getting ready

Log in to any of the nodes in the cluster. It's best to use the edge node, as stated in Chapter 1, Hadoop Architecture and Deployment, and switch to user hadoop.

Create a simple text file named file1.txt using any of your favorite text editors, and write some content in it.

How to do it...

  1. Connect to the client1.cluster1.com edge node and switch to the hadoop user.

  2. Copy the file1.txt file to HDFS, as shown in the following screenshot:

  3. The user can check for the status of a file, as shown in the following screenshot:

  4. The user can make sure that the file exists and its type is correct, as shown in the following screenshot. The user can execute the commands to see the sub options:

    $ hadoop fs (and hit enter to see the options)
    

How it works...

Steps 2 and 3 create a simple text file on the local filesystem and then copy it to HDFS to make sure that...

Configuring HDFS replication


For redundancy, it is important to have multiple copies of data. In HDFS, this is achieved by placing copies of blocks on different nodes. By default, the replication factor is 3, which means that for each block written to HDFS, there will be three copies in total on the nodes in the cluster.

It is important to make sure that the cluster is working fine and the user can perform file operations on the cluster.

Getting ready

Log in to any of the nodes in the cluster. It is best to use the edge node, as stated in Chapter 1, and switch to the user hadoop.

Create a simple text file named file1.txt using any of your favorite text editors, and write some content in it.

How to do it...

  1. ssh to the Namenode, which in this case is nn1.cluster1.com, and switch to user hadoop.

  2. Navigate to the /opt/cluster/hadoop/etc/hadoop directory. This is the directory where we installed Hadoop in Chapter 1, Hadoop Architecture and Deployment. If the user has installed it at a different location...

HDFS balancer


In a long-running cluster, there might be unequal distribution of data across Datanodes. This could be due to failures of nodes or the addition of nodes to the cluster.

To make sure that the data is equally distributed across Datanodes, it is important to use Hadoop balancer to redistribute the blocks.

Getting ready

For this recipe, you will again use the same node on which we have already configured Namenode.

All operations will be done by user hadoop.

How to do it...

  1. Log in the nn1.cluster1.com node and change to user hadoop.

  2. Execute the balancer command as shown in the following screenshot:

  3. By default, the balancer threshold is set to 10%, but we can change it, as shown in the following screenshot:

How it works...

The balancer threshold defines the percentage of cluster disk space utilized, compared to the nodes in the cluster. For example, let's say we have 10 Datanodes in the cluster, with each having 100 GB of disk storage totaling to about 1 TB.

So, when we say the threshold is...

Quota configuration


In a multitenancy cluster, it is important to control the utilization both in terms of HDFS space, memory, and CPU utilization. In this recipe, we will be looking at how we can restrict a user or a project from using more than the allotted HDFS space.

Getting ready

Make sure that there is a running cluster, and that the user is already well versed in the recipes that we have looked at so far.

How to do it...

  1. Connect to Namenode and change the user to hadoop.

  2. Create a directory named projects on HDFS, as shown in the following screenshot:

  3. By default, there is no quota configured on any directory.

  4. To see what options can be set on the projects directory, use the following command:

    $ hadoop fs -count -q /projects
  5. The two leftmost fields show the namespace and disk space quota, which currently is not set, as shown in the following screenshot:

  6. To set the namespace quota, which will define how many inodes can be allocated for this projects directory, enter the following code. Inodes...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Become an expert Hadoop administrator and perform tasks to optimize your Hadoop Cluster
  • Import and export data into Hive and use Oozie to manage workflow.
  • Practical recipes will help you plan and secure your Hadoop cluster, and make it highly available

Description

Hadoop enables the distributed storage and processing of large datasets across clusters of computers. Learning how to administer Hadoop is crucial to exploit its unique features. With this book, you will be able to overcome common problems encountered in Hadoop administration. The book begins with laying the foundation by showing you the steps needed to set up a Hadoop cluster and its various nodes. You will get a better understanding of how to maintain Hadoop cluster, especially on the HDFS layer and using YARN and MapReduce. Further on, you will explore durability and high availability of a Hadoop cluster. You’ll get a better understanding of the schedulers in Hadoop and how to configure and use them for your tasks. You will also get hands-on experience with the backup and recovery options and the performance tuning aspects of Hadoop. Finally, you will get a better understanding of troubleshooting, diagnostics, and best practices in Hadoop administration. By the end of this book, you will have a proper understanding of working with Hadoop clusters and will also be able to secure, encrypt it, and configure auditing for your Hadoop clusters.

Who is this book for?

If you are a system administrator with a basic understanding of Hadoop and you want to get into Hadoop administration, this book is for you. It’s also ideal if you are a Hadoop administrator who wants a quick reference guide to all the Hadoop administration-related tasks and solutions to commonly occurring problems

What you will learn

  • • Set up the Hadoop architecture to run a Hadoop cluster smoothly
  • • Maintain a Hadoop cluster on HDFS, YARN, and MapReduce
  • • Understand high availability with Zookeeper and Journal Node
  • • Configure Flume for data ingestion and Oozie to run various workflows
  • • Tune the Hadoop cluster for optimal performance
  • • Schedule jobs on a Hadoop cluster using the Fair and Capacity scheduler
  • • Secure your cluster and troubleshoot it for various common pain points

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 26, 2017
Length: 348 pages
Edition : 1st
Language : English
ISBN-13 : 9781787126879
Vendor :
Apache
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 26, 2017
Length: 348 pages
Edition : 1st
Language : English
ISBN-13 : 9781787126879
Vendor :
Apache
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just zł20 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just zł20 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 549.97
Hadoop 2.x Administration Cookbook
zł221.99
Data Lake for Enterprises
zł149.99
Frank Kane's Taming Big Data with Apache Spark and Python
zł177.99
Total 549.97 Stars icon
Banner background image

Table of Contents

13 Chapters
1. Hadoop Architecture and Deployment Chevron down icon Chevron up icon
2. Maintaining Hadoop Cluster HDFS Chevron down icon Chevron up icon
3. Maintaining Hadoop Cluster – YARN and MapReduce Chevron down icon Chevron up icon
4. High Availability Chevron down icon Chevron up icon
5. Schedulers Chevron down icon Chevron up icon
6. Backup and Recovery Chevron down icon Chevron up icon
7. Data Ingestion and Workflow Chevron down icon Chevron up icon
8. Performance Tuning Chevron down icon Chevron up icon
9. HBase Administration Chevron down icon Chevron up icon
10. Cluster Planning Chevron down icon Chevron up icon
11. Troubleshooting, Diagnostics, and Best Practices Chevron down icon Chevron up icon
12. Security Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.5
(2 Ratings)
5 star 50%
4 star 0%
3 star 0%
2 star 50%
1 star 0%
Jayesh Jun 02, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Writer has fair knowledge on subject.
Amazon Verified review Amazon
Zvonko Pino Varela Apr 29, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
It looks out of date. I followed the instructions step by step but I found a lot of mistakes, and many instructions didn't work. It's far better to install Apache Ambari and follow those directions.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.