我的 debian (squeeze) 服务器上的 updatedb 数据库很慢。
*/.git/*
, */.svn/*
和类似的路径?PRUNEPATHS
?我/etc/updatedb.conf
看起来像这样:
...
# filesystems which are pruned from updatedb database
PRUNEFS="NFS nfs nfs4 afs binfmt_misc proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifs lustre_lite tmpfs usbfs udf"
export PRUNEFS
# paths which are pruned from updatedb database
PRUNEPATHS="/tmp /usr/tmp /var/tmp /afs /amd /alex /var/spool /sfs /media /var/backups/rsnapshot /var/mod_pagespeed/"
...
Run Code Online (Sandbox Code Playgroud)
编辑:
/var/cache/locate/locatedb
locate /
将列出数据库中的所有文件和目录(我通过将其导出到文件中来查看结果:locate />/tmp/locatedb.txt
,下载此 txt 文件并找到大量无用的东西)PRUNENAMES
如中所述使用man updatedb.conf
不应该被 updatedb(8) 扫描的以空格分隔的目录名称列表(没有路径)。默认情况下,不会跳过任何目录名称。
指某东西的用途
PRUNENAMES=".git .hg .svn"
应该可以解决问题(上面的行是 Fedora 18 上的标准值)。
You are probably using the GNU findutils version of locate, which doesn't support the PRUNENAMES option. Installing mlocate will provide these configuration options:
apt-get remove locate
mv /etc/updatedb.conf /etc/updatedb.conf-GNU.old
apt-get install mlocate
Run Code Online (Sandbox Code Playgroud)
Now with the mlocate packge you can edit or create /etc/updatedb.conf and add these lines:
PRUNENAMES=".git .bzr .hg .svn"
PRUNEPATHS="/tmp /var/spool /var/cache /media /usr/tmp /var/tmp /sfs /afs /amd /alex /var/backups/rsnapshot /var/mod_pagespeed"
# the paths in `PRUNEPATHS` must be without trailing slashes
Run Code Online (Sandbox Code Playgroud)
Then actualize the database with:
updatedb
Run Code Online (Sandbox Code Playgroud)
You probably can remove the huge old locate database:
rm /var/cache/locate/locatedb
Run Code Online (Sandbox Code Playgroud)
(mlocate 数据库存储在/var/lib/mlocate/mlocate.db
)
查看https://apps.ubuntu.com/cat/applications/mlocate/以获取有关该软件包的更多信息。
(我花了很多时间试图解决类似的问题!)
归档时间: |
|
查看次数: |
6443 次 |
最近记录: |