通过man ps可以查到:
1234567 D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to complete)
T Stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z Defunct ("zombie") process, terminated but not reaped by its parent.
D的状态一般是I/O出现了问题,说明进程在等待I/O,可以是磁盘I/O,网络I/O或者其他,可以看出
/bin/sh /data1/minisearch/intranews3/3/bin/shell/idxserver.sh
这个进程已经有I/O限制
lsof -p 进程号
为了查看此进程在读哪个文件,或者在写入哪个文件
[root@localhost ~]# lsof -p 27746
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
idxserver 27746 search cwd DIR 8,6 4096 79691789 /data1/minisearch/intranews3/6/bin
idxserver 27746 search rtd DIR 8,3 4096 2 /
idxserver 27746 search txt REG 8,3 939344 4213 /bin/bash
idxserver 27746 search mem REG 8,3 156928 7113 /lib64/ld-2.12.so
idxserver 27746 search mem REG 8,3 1926800 7114 /lib64/libc-2.12.so
idxserver 27746 search mem REG 8,3 22536 7119 /lib64/libdl-2.12.so
idxserver 27746 search mem REG 8,3 138280 1415 /lib64/libtinfo.so.5.7
idxserver 27746 search mem REG 8,1 99158576 524298 /usr/lib/locale/locale-archive
idxserver 27746 search mem REG 8,1 26060 655626 /usr/lib64/gconv/gconv-modules.cache
idxserver 27746 search 0r CHR 1,3 0t0 3968 /dev/null
idxserver 27746 search 1w REG 8,6 229869234162 79692293 /data1/minisearch/intranews3/6/log/idxserver.out
idxserver 27746 search 2w REG 8,6 229869234162 79692293 /data1/minisearch/intranews3/6/log/idxserver.out
查看哪一块磁盘占用的磁盘I/O比较高iostat
[root@localhost ~]# iostat -xk 1
Linux 2.6.32-431.11.2.el6.toa.2.x86_64 (localhost.localdomain) 09/01/2016 _x86_64_ (8 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
10.87 0.00 4.32 3.70 0.00 81.11
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 1.15 239.29 119.35 9.46 3057.00 995.47 62.92 0.04 0.29 0.62 7.99
avg-cpu: %user %nice %system %iowait %steal %idle
2.52 0.00 2.14 76.98 0.00 18.36
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 25.00 0.00 1670.00 0.00 49600.00 0.00 59.40 135.50 40.75 0.60 100.00
avg-cpu: %user %nice %system %iowait %steal %idle
5.42 0.00 0.88 73.30 0.00 20.40
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 26.00 0.00 1538.00 0.00 50996.00 0.00 66.31 133.85 42.16 0.65 100.10