在使用电脑中难免会遇到一些程序占用率高的情况,使用linux系统也是如此,遇到系统硬盘IO占用很高,系统IO占用可以使用iostat -x 1查看。但很多时候知道磁盘IO负载高,但并不知道是什么程序占用的,是PHP,还是MYSQL,还是其它的,这时候我们可以通过iotop工具可以实现查看,下面来介绍下在linux中iotop 安装步骤及使用教程吧。
官方的说明:
Linux has always been able to show how much I/O was going on (the bi and bo columns of the vmstat 1 command).
Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires Python ≥ 2.7 and a Linux kernel ≥ 2.6.20 with the TASK_DELAY_ACCT CONFIG_TASKSTATS, TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on.
iotop安装步骤:
直接yum安装。
yum install iotop
在Ubuntu里安装命令是: sudo apt-get install iotop
安装好之后在终端输入:iotop就可以了
或者:
git clone git://repo.or.cz/iotop.git
iotop使用说明:
可以用左右箭头操作,按 r 是相反方向,按 o 是动态切换
用法 iotop -参数
–version 查看版本信息的
-h, –help 查看帮助信息的
-o, –only 只显示在划硬盘的程序
-b, –batch 批量处理 用来记录日志的
-n NUM 设定循环几次
-d SEC, –delay=SEC 设定显示时间间隔
通过 iotop 工具,我们可以清清楚楚的查看到硬盘IO的详细使用情况了。