Yum

我能做些什麼來加快 createrepo 的速度?

  • April 3, 2018

我們正在使用 yum 儲存庫將我們的軟體分發到我們的生產實例。不幸的是,createrepo 正在成為一個瓶頸,我們在儲存庫中只有 469 個包。

$ time createrepo /opt/tm-yum-repo
Spawning worker 0 with 469 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

real    0m43.188s
user    0m37.798s
sys 0m1.296s

我該怎麼做才能讓它更快?

dmourati 在他的回答中給出的--cachedir選項將對您有所幫助,但您也應該使用--update,特別是如果您不一次更換所有 469 包。

      --update
             If metadata already exists  in  the  outputdir  and  an  rpm  is
             unchanged  (based on file size and mtime) since the metadata was
             generated, reuse the existing metadata rather than recalculating
             it.  In  the  case  of a large repository with only a few new or
             modified rpms this can significantly reduce I/O  and  processing
             time.

此外,如果以這種方式部署它確實對時間敏感並且--update沒有足夠的幫助,請考慮為此包創建一個單獨的 repo。

引用自:https://serverfault.com/questions/549536