加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 服务器上的奇怪进程消耗CPU

发布时间:2020-12-13 16:44:19 所属栏目:Linux 来源:网络整理
导读:我注意到服务器上15%的CPU负载当前处于脱机状态.它已通过TCP挂载GlusterFS卷.从顶部看,它向我展示了它的glusterfs.之后,我试图弄清楚究竟是什么使用它,我得到了这个: # lsof /storage/COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEfind 16433 nobod
我注意到服务器上15%的CPU负载当前处于脱机状态.它已通过TCP挂载GlusterFS卷.从顶部看,它向我展示了它的glusterfs.之后,我试图弄清楚究竟是什么使用它,我得到了这个:
# lsof /storage/
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF                NODE NAME
find    16433 nobody  cwd    DIR   0,19     8192 9259265867489333824 /storage/200000/200000/200700/200704/08

然后:

# ps uax | grep find
root     16415  0.0  0.0   4400   724 ?        SN   06:34   0:00 /bin/sh /usr/bin/updatedb.findutils
root     16423  0.0  0.0   4400   336 ?        SN   06:34   0:00 /bin/sh /usr/bin/updatedb.findutils
nobody   16431  0.0  0.0  39524  1376 ?        SN   06:34   0:00 su nobody -s /bin/sh -c /usr/bin/find / -ignore_readdir_race      ( -fstype NFS -o -fstype nfs -o -fstype nfs4 -o -fstype afs -o -fstype binfmt_misc -o -fstype proc -o -fstype smbfs -o -fstype autofs -o -fstype iso9660 -o -fstype ncpfs -o -fstype coda -o -fstype devpts -o -fstype ftpfs -o -fstype devfs -o -fstype mfs -o -fstype shfs -o -fstype sysfs -o -fstype cifs -o -fstype lustre_lite -o -fstype tmpfs -o -fstype usbfs -o -fstype udf -o -fstype ocfs2 -o      -type d -regex '(^/tmp$)|(^/usr/tmp$)|(^/var/tmp$)|(^/afs$)|(^/amd$)|(^/alex$)|(^/var/spool$)|(^/sfs$)|(^/media$)|(^/var/lib/schroot/mount$)' ) -prune -o -print0
nobody   16432  0.0  0.0   4400   616 ?        SN   06:34   0:00 sh -c /usr/bin/find / -ignore_readdir_race      ( -fstype NFS -o -fstype nfs -o -fstype nfs4 -o -fstype afs -o -fstype binfmt_misc -o -fstype proc -o -fstype smbfs -o -fstype autofs -o -fstype iso9660 -o -fstype ncpfs -o -fstype coda -o -fstype devpts -o -fstype ftpfs -o -fstype devfs -o -fstype mfs -o -fstype shfs -o -fstype sysfs -o -fstype cifs -o -fstype lustre_lite -o -fstype tmpfs -o -fstype usbfs -o -fstype udf -o -fstype ocfs2 -o      -type d -regex '(^/tmp$)|(^/usr/tmp$)|(^/var/tmp$)|(^/afs$)|(^/amd$)|(^/alex$)|(^/var/spool$)|(^/sfs$)|(^/media$)|(^/var/lib/schroot/mount$)' ) -prune -o -print0
nobody   16433  0.3  0.0  13612  1532 ?        SN   06:34   0:38 /usr/bin/find / -ignore_readdir_race ( -fstype NFS -o -fstype nfs -o -fstype nfs4 -o -fstype afs -o -fstype binfmt_misc -o -fstype proc -o -fstype smbfs -o -fstype autofs -o -fstype iso9660 -o -fstype ncpfs -o -fstype coda -o -fstype devpts -o -fstype ftpfs -o -fstype devfs -o -fstype mfs -o -fstype shfs -o -fstype sysfs -o -fstype cifs -o -fstype lustre_lite -o -fstype tmpfs -o -fstype usbfs -o -fstype udf -o -fstype ocfs2 -o -type d -regex (^/tmp$)|(^/usr/tmp$)|(^/var/tmp$)|(^/afs$)|(^/amd$)|(^/alex$)|(^/var/spool$)|(^/sfs$)|(^/media$)|(^/var/lib/schroot/mount$) ) -prune -o -print0

我杀了16432和16433,CPU现在又是%0.

有人可以告诉我这些丑陋的发现命令吗?是否有可能是由于其他服务器也安装了这个/存储器?

根据监测,它每天都在同一时间发生.

解决方法

看起来它是每日 updatedb作业的一部分,用于更新 locate命令使用的数据库.

你可能会在/etc/cron.daily中找到它作为mlocate或类似的东西.

如果使用ps -ef,则会获得可用于追溯的PID(进程)和PPID(父PID).你可能会看到你杀死的进程有PPID 16415,16423.

像pstree这样的工具对于这种事情也很方便.

pstree -p -H5295

给出这样的输出

|-sshd(5291)---sshd(5294)---bash(5295)-+-more(6098)
  |                                      `-pstree(6097)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读