Linux下Hadoop资源分配主要通过YARN实现,核心配置如下:
资源隔离与配额
yarn.scheduler.minimum-allocation-mb
和yarn.scheduler.maximum-allocation-mb
设置容器最小/最大内存。yarn.scheduler.minimum-allocation-vcores
和yarn.scheduler.maximum-allocation-vcores
设置容器最小/最大CPU核数。调度器配置
capacity-scheduler.xml
中配置队列权重及资源比例。fair-scheduler.xml
中定义资源池和分配策略。节点资源管理
yarn-site.xml
中配置yarn.nodemanager.resource.memory-mb
和yarn.nodemanager.resource.cpu-vcores
,限制单个节点可用的内存和CPU资源。yarn.nodemanager.local-dirs
和yarn.nodemanager.log-dirs
分散存储压力,避免单点瓶颈。动态调整与监控
yarn.dynamic.resource.allocation.enabled=true
),根据负载实时调整资源。http://<ResourceManager_IP>:8088
)监控资源使用情况,或通过Ganglia等工具集成监控。关键参数来源: