---
title: 使用OmniScheduler Yarn负载调度算法
description: "1. 进入“/home/hadoop/loadsmetric-install/loadsmetric-server/etc”目录。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2530/bds/kunpengbds_omniruntime_20_0819.html
sourcePath: /source/zh/kunpengboostkithistory/2530/bds/kunpengbds_omniruntime_20_0819.html
indexId: e61f850030adb40e82d27a1a2d6fb105fa215893d9645b0e9f8f1faa927eff5378
---
# 使用OmniScheduler Yarn负载调度算法

1. 进入“/home/hadoop/loadsmetric-install/loadsmetric-server/etc”目录。

```
cd /home/hadoop/loadsmetric-install/loadsmetric-server/etc
```


2. 可选：按需修改LoadsMetric配置项（不需要则忽略）。

  a. 打开配置文件。

```
vim application.properties
```


  b. 按“i”进入编辑模式，按需修改利用率阈值配置项和利用率权重配置项，前者影响集群超载节点的判断，后者影响节点负载排序结果，参数说明请参见    相关参考
。

```
# limits for multi resource usage
load.limit.cpu=80
load.limit.mem=80
load.limit.diskio=80
load.limit.netio=80
# weights for multi resource usage
load.weight.cpu=0.3
load.weight.mem=0.3
load.weight.diskio=0.2
load.weight.netio=0.2
```


  c. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
3. 重启LoadsMetric服务，使配置项生效。

```
cd /home/hadoop/loadsmetric-software
sh loadsmetric_deploy.sh restart
```


4. 执行计算任务（如Spark任务），开始Yarn资源调度，参考命令如下。

```
spark-sql --deploy-mode client --driver-cores 8 --driver-memory 20g --num-executors 3 --executor-cores 7 --executor-memory 26g --master yarn  --conf spark.task.cpus=1 --conf spark.sql.orc.impl=native --conf spark.sql.shuffle.partitions=1000 --conf spark.network.timeout=600  --conf spark.sql.adaptive.enabled=true --conf spark.sql.adaptive.skewedJoin.enabled=true --conf spark.serializer=org.apache.spark.serializer.KryoSerializer --conf spark.sql.autoBroadcastJoinThreshold=100M --properties-file /home/spark.conf --database tpcds_bin_partitioned_decimal_orc_3000
```
