1. 程式人生 > 其它 >HADOOP YARN(2):YARN資源排程器(2)入門

HADOOP YARN(2):YARN資源排程器(2)入門

5 Yarn常用命令

Yarn狀態的查詢,除了可以在hadoop103:8088頁面檢視外,還可以通過命令操作。常見的命令操作如下所示:

需求:執行WordCount案例,並用Yarn命令檢視任務執行情況。

[atguigu@hadoop102 hadoop-3.1.3]$ myhadoop.sh start

[atguigu@hadoop102 hadoop-3.1.3]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar wordcount /input /output

5.1yarn application
檢視任務

1列出所有Application:

[atguigu@hadoop102 hadoop-3.1.3]$ yarn application -list
2021-02-06 10:21:19,238 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Total number of applications (application-types: [], states: [SUBMITTED, ACCEPTED, RUNNING] and tags: []):0
                Application
-Id Application-Name Application-Type User Queue State Final-State Progress Tracking-URL

2根據Application狀態過濾:yarn application -list -appStates (所有狀態:ALLNEWNEW_SAVINGSUBMITTEDACCEPTEDRUNNINGFINISHED

FAILEDKILLED

[atguigu@hadoop102 hadoop-3.1.3]$ yarn application -list -appStates FINISHED
2021-02-06 10:22:20,029 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Total number of applications (application-types: [], states: [FINISHED] and tags: []):1
                Application-Id        Application-Name        Application-Type          User         Queue                 State           Final-State           Progress                           Tracking-URL
application_1612577921195_0001              word count               MAPREDUCE       atguigu       default              FINISHED             SUCCEEDED               100%    http://hadoop102:19888/jobhistory/job/job_1612577921195_0001

3KillApplication

[atguigu@hadoop102 hadoop-3.1.3]$ yarn application -kill application_1612577921195_0001
2021-02-06 10:23:48,530 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Application application_1612577921195_0001 has already finished

5.2yarn logs檢視日誌

5.3yarn applicationattempt檢視嘗試執行的任務

1列出所有Application嘗試的列表:yarn applicationattempt -list <ApplicationId>

5.4yarn container檢視容器

1列出所有Container:yarn container -list <ApplicationAttemptId>

[atguigu@hadoop102 hadoop-3.1.3]$ yarn container -list appattempt_1612577921195_0001_000001
2021-02-06 10:28:41,396 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Total number of containers :0
                  Container-Id              Start Time             Finish Time                   State                    Host       Node Http Address    

5.5yarn node檢視節點狀態

列出所有節點:yarn node -list -all

5.6yarn rmadmin更新配置

載入佇列配置:yarn rmadmin -refreshQueues

[atguigu@hadoop102 hadoop-3.1.3]$ yarn rmadmin -refreshQueues
2021-02-06 10:32:03,331 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8033

5.7yarn queue檢視佇列

列印佇列資訊:yarn queue -status <QueueName>

[atguigu@hadoop102 hadoop-3.1.3]$ yarn queue -status default
2021-02-06 10:32:33,403 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.10.103:8032
Queue Information : 
Queue Name : default
    State : RUNNING
    Capacity : 100.0%
    Current Capacity : .0%
    Maximum Capacity : 100.0%
    Default Node Label expression : <DEFAULT_PARTITION>
    Accessible Node Labels : *
    Preemption : disabled
    Intra-queue Preemption : disabled

6 Yarn生產環境核心引數

本文來自部落格園,作者:秋華,轉載請註明原文連結:https://www.cnblogs.com/qiu-hua/p/15229160.html