1、动态更新yarn nodemanager资源分配
在配置目录下,增加dynamic-resources.xml配置文件,内容如下,
<configuration>
<property>
<name>yarn.resource.dynamic.${HOSTNAME}:45454.memory</name>
<value>53248</value>
</property>
<property>
<name>yarn.resource.dynamic.${HOSTNAME}:45454.vcores</name>
<value>28</value>
</property>
</configuration>
即NodeManger分配52GB内存和28 CPU cores。注意${HOSTNAME}替换为NodeManager主机名。
2、动态更新配置文件
yarn rmadmin -updateNodeResource ${HOSTNAME}:45454 53248 28
验证:
$ yarn node -status `hostname`:45454
18/08/30 22:40:42 INFO client.RMProxy: Connecting to ResourceManager at chen-test/192.168.2.2:8050
18/08/30 22:40:42 INFO client.AHSProxy: Connecting to Application History server at chen-test/192.168.2.2:10200
Node Report :
Node-Id : chen-test.com:45454
Rack : /default-rack
Node-State : RUNNING
Node-Http-Address : chen-test.com:8042
Last-Health-Update : Thu 30/Aug/18 10:38:44:157CST
Health-Report :
Containers : 1
Memory-Used : 4096MB
Memory-Capacity : 53248MB
CPU-Used : 4 vcores
CPU-Capacity : 28 vcores
Node-Labels : high_cpu
或者通过YARN webUI 查看节点资源信息。