当前位置:网站首页>[yarn] yarn container log cleaning
[yarn] yarn container log cleaning
2022-07-06 11:31:00 【kiraraLou】
Preface
Let's tidy up today yarn Container
Log cleaning mechanism .
One 、container Log directory structure
Yarn container
The log directory structure of is shown in the following figure .
NodeManager
The same directory structure will be established for the same application on all directories , And the polling scheduling method is used to allocate these directories to different Container Use . Every Container Three types of logs will be output :
stdout
: Log printed using standard output function , such as Java MediumSystem.out.print
Output content .stderr
: Log information generated by standard error output .syslog
: Use log4j Printed log information , This is the most commonly used way to print logs , By default ,YARN The log is printed in this way , let me put it another way , Usually , Only this file has content , The other two files are empty .
This configuration is yarn.nodemanager.log-dirs
.
Two 、 Log cleaning mechanism
because NodeManager
Will all Container
Save the running log of to the local disk , therefore , Over time , There will be more and more logs . To avoid a lot of Container
journal “ Burst ” disk space ,NodeManager
Log files will be cleaned up periodically , This function consists of components LogHandler
( There are currently two implementations :NonAggregatingLogHandler
and LogAggregationService
) complete .
In total ,NodeManager
Provides regular deletion ( from NonAggregatingLogHandler
Realization ) And log aggregation transfer ( from LogAggregation-Service
Realization ) Two log cleaning mechanisms , By default , The mechanism of regular deletion is adopted .
1. Delete periodically
NodeManager
Allow an application log to remain on disk for yarn.nodemanager.log.retain-seconds
( The unit is seconds , The default is 3×60×60, namely 3 Hours ), Once that time has passed ,NodeManager
All logs of the application will be deleted from the disk .
2. Log aggregation and forwarding
Except for regular deletion ,NodeManager
Another log processing method is also provided —— Log aggregation and forwarding [ illustrations ], Administrators can configure parameters yarn.log-aggregation-enable
Set as true
Enable this feature .
The mechanism will HDFS As a log aggregation warehouse , It uploads the logs generated by the application to HDFS On , For unified management and maintenance . The mechanism consists of two stages : File upload and file lifecycle management .
(1) Upload files
When an application finishes running , All logs generated by it will be uploaded to HDFS Upper ${remoteRootLogDir}/${user}/${suffix}/${appid}
${remoteRootLogDir}
The value is determined by the parameteryarn.nodemanager.remote-app-log-dir
Appoint , The default is/tmp/logs
${user}
For the application owner${suffix}
The value is determined by the parameteryarn.nodemanager.remote-app-log-dir-suffix
Appoint , The default is "logs"${appid}
For applications ID
And all logs in the same node are saved to the same file in the directory , These files are represented by nodes ID name .
The log structure is shown in the following figure .
Once all the logs are uploaded to HDFS after , The log files on the local disk will be deleted . Besides , In order to reduce unnecessary log uploading ,NodeManager
Allow users to specify the log type to upload . There are three types of logs currently supported :
ALL_CONTAINERS
( Upload allContainer
journal )APPLICATION_MASTER_ONLY
( Upload onlyApplicationMaster
Generated log )AM_AND_FAILED_CONTAINERS_ONLY
( UploadApplicationMaster
And failedContainer
Generated log ), By defaultALL_CONTAINERS
.
(2) File lifecycle management
Transfer to HDFS The life cycle of logs on is no longer controlled by NodeManager
be responsible for , But by the JobHistory
Service management . For example, for MapReduce
In terms of computational framework , It's proprietary JobHistory
Be responsible for regular cleaning MapReduce
Transfer the job to HDFS
Log on , The maximum retention time of each log file is yarn.log-aggregation.retain-seconds
( The unit is seconds , The default is 3×60×60, namely 3 Hours ).
Users can view the application log in two ways , One is through NodeManager Of Web Interface ; The other is through Shell Command view .
View all logs generated by an application , The order is as follows :
bin/yarn logs -applicationId application_130332321231_0001
View one Container Generated log , The order is as follows :
bin/yarn logs -applicationId application_130332321231_0001 -containerId container_130332321231_0002 -nodeAddress 127.0.0.1_45454
summary
Yarn Container
There are two mechanisms: local deletion and log aggregation and transfer deletion .Yarn Contaioner
Local logs are created byyarn.nodemanager.log.retain-seconds
control .yarn.log-aggregation-enable
Is to enable log aggregation and transfer .- The log after transferring is saved by
yarn.log-aggregation.retain-seconds
control .
边栏推荐
- Learn winpwn (3) -- sEH from scratch
- Software testing - interview question sharing
- AcWing 1298.曹冲养猪 题解
- wangeditor富文本组件-复制可用
- Unable to call numpy in pycharm, with an error modulenotfounderror: no module named 'numpy‘
- Codeforces Round #753 (Div. 3)
- When using lambda to pass parameters in a loop, the parameters are always the same value
- 牛客Novice月赛40
- [蓝桥杯2020初赛] 平面切分
- Error reporting solution - io UnsupportedOperation: can‘t do nonzero end-relative seeks
猜你喜欢
QT creator shape
{一周总结}带你走进js知识的海洋
PyCharm中无法调用numpy,报错ModuleNotFoundError: No module named ‘numpy‘
neo4j安装教程
Knowledge Q & A based on Apache Jena
One click extraction of tables in PDF
Why can't I use the @test annotation after introducing JUnit
Machine learning -- census data analysis
Connexion sans mot de passe du noeud distribué
Learn winpwn (2) -- GS protection from scratch
随机推荐
Machine learning -- census data analysis
vs2019 使用向导生成一个MFC应用程序
Unable to call numpy in pycharm, with an error modulenotfounderror: no module named 'numpy‘
Deoldify project problem - omp:error 15:initializing libiomp5md dll,but found libiomp5md. dll already initialized.
數據庫高級學習筆記--SQL語句
What does BSP mean
使用lambda在循环中传参时,参数总为同一个值
天梯赛练习集题解LV1(all)
[download app for free]ineukernel OCR image data recognition and acquisition principle and product application
牛客Novice月赛40
Cookie setting three-day secret free login (run tutorial)
Codeforces Round #771 (Div. 2)
L2-004 这是二叉搜索树吗? (25 分)
[Bluebridge cup 2021 preliminary] weight weighing
Test objects involved in safety test
Kept VRRP script, preemptive delay, VIP unicast details
ES6 Promise 对象
02 staff information management after the actual project
Integration test practice (1) theoretical basis
PHP - whether the setting error displays -php xxx When PHP executes, there is no code exception prompt