为 EC2 实例上基于 SSD 的 RAID 阵列设置 I/O 调度程序

为 EC2 实例上基于 SSD 的 RAID 阵列设置 I/O 调度程序

我使用 EC2 c3.4xlarge 实例上的 2 个本地 SSD 驱动器创建了一个 RAID 阵列。

# mdadm --create /dev/md127 --level=0 --raid-devices=2 /dev/xvdf /dev/xvdg
# mkfs.ext4 /dev/md127
# mkdir /data
# echo 'DEVICE /dev/xvdf /dev/xvdg' > /etc/mdadm.conf
# mdadm --detail --scan >> /etc/mdadm.conf
# echo "/dev/md127   /data       ext4    defaults 1 2" >> /etc/fstab 

该设备运行良好。但是,当我尝试为阵列设置 I/O 调度程序(以 root 身份)时,调度程序文件没有改变。

# echo noop >  /sys/block/md127/queue/scheduler
# cat /sys/block/md127/queue/scheduler 
  none

设置调度程序的正确方法是什么,以便最后的命令输出是“noop”?

答案1

不要手动操作。我的意思是,你通过附加内核启动参数行来全局配置。但是,使用tuned-utils 框架来处理这个问题。

yum install tuned tuned-utils

一旦安装...

tuned-adm profile virtual-guest 

或者根据虚拟嘉宾创建您自己的个人资料。

在 中/etc/tune-profiles/virtual-guest有这么一节:

# This is the I/O scheduler ktune will use.  This will *not* override anything
# explicitly set on the kernel command line, nor will it change the scheduler
# for any block device that is using a non-default scheduler when ktune starts.
# You should probably leave this on "deadline", but "as", "cfq", and "noop" are
# also legal values.  Comment this out to prevent ktune from changing I/O
# scheduler settings.
ELEVATOR="deadline"

修改口味然后完成!

相关内容