Hadoop Yarn Commands container

HadoopHadoopBeginner
Practice Now

Introduction

The residents of the idyllic Sunken Treasure Bay have long been fascinated by the tale of a legendary pirate ship that sank near their shores centuries ago. According to local lore, the ship's hold was filled with priceless treasures that have yet to be discovered. One day, a curious resident named Jack stumbles upon an ancient map that promises to lead him to the sunken riches. Emboldened by the prospect of uncovering the lost treasure, Jack embarks on an exciting adventure, determined to unravel the mysteries of the deep and claim the legendary bounty.

In this lab, you will step into Jack's shoes and learn how to navigate the intricate world of Hadoop YARN commands while searching for the sunken treasure. Your mission is to master the art of managing containers, a crucial component of the YARN architecture, which will aid you in your quest for the elusive riches.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL hadoop(("`Hadoop`")) -.-> hadoop/HadoopYARNGroup(["`Hadoop YARN`"]) hadoop/HadoopYARNGroup -.-> hadoop/yarn_container("`Yarn Commands container`") subgraph Lab Skills hadoop/yarn_container -.-> lab-289010{{"`Hadoop Yarn Commands container`"}} end

Exploring YARN Container Commands

In this step, you will familiarize yourself with the fundamental YARN container commands, which will equip you with the necessary tools to investigate the sunken ship's cargo hold.

First, ensure that you have switched to the hadoop user in the terminal. All commands should be executed within the /home/hadoop directory or its subdirectories.

su - hadoop

You need run following command to start the container in another terminal using hadoop user.

yarn jar /home/hadoop/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.3.6.jar pi 7 7

List all running containers

yarn container -list <application_id/application_name>

The yarn container -list command displays a list of all currently running containers in the YARN cluster. This will provide you with an overview of the active containers, which may hold clues about the location of the sunken treasure.

tip:You can use yarn application -list to list all application.

Get the details of a specific container

yarn container -status <container_id>

The yarn container -status <container_id> command retrieves detailed information about a specific container identified by its container_id. By examining the container's status, you can gather insights into its resource allocation, execution progress, and potential connections to the lost riches.

Managing Containers with YARN Commands

As you delve deeper into your quest, you may need to take more control over the containers to uncover hidden clues or unlock new pathways. The following commands will empower you to manage containers effectively:

Stop a running container

yarn container -kill <container_id>

The yarn container -kill <container_id> command allows you to terminate a running container identified by its container_id. This can be useful if you suspect a container is leading you astray or if you need to free up resources for further exploration.

Get the logs of a container

yarn logs -containerId <container_id>

The yarn logs -containerId <container_id> command retrieves the log files associated with a specific container. Analyzing these logs may reveal crucial information, such as error messages or hidden clues, that could guide you closer to the sunken treasure.

Advanced Container Management

As your knowledge of YARN container commands deepens, you'll uncover more advanced techniques to aid your quest for the legendary treasure:

Get the container report

yarn container -report <container_id>

The yarn container -report <container_id> command provides a comprehensive report on a specific container, including its resource allocation, execution status, and other relevant details. This report can offer valuable insights into the container's role in your treasure-hunting endeavor.

Get the container's attempt report

yarn container -attempts <container_id>

The yarn container -attempts <container_id> command displays information about the container's previous attempts or retries. This can be particularly useful when troubleshooting issues or tracking the container's history, which may contain clues about the sunken riches.

Get the container's node report

yarn container -node <container_id>

The yarn container -node <container_id> command retrieves information about the node on which the container is running. Understanding the node's characteristics and resource availability can help you optimize your container's performance and increase your chances of success in locating the treasure.

Summary

In this lab, you embarked on an exciting adventure to uncover the legendary sunken treasure by mastering the art of managing YARN containers. Through a series of hands-on steps, you learned how to list running containers, retrieve container status, stop containers, and analyze their logs. Additionally, you explored advanced techniques such as generating container reports, examining attempt histories, and investigating node information.

Other Hadoop Tutorials you may like