Cache

Squid 從不使用 dnf 記憶體文件

  • December 16, 2015

我正在嘗試為 dnf 設置本地儲存庫記憶體。這個想法是讓網路上的一台機器下載一個包,然後網路上任何其他試圖獲取包的機器將從記憶體中接收它。我正在為此使用 squid,並且目前有 dnf 通過 squid 伺服器請求包,但是 squid 每次都記錄一個未命中。我不確定是什麼原因造成的,所以我將複製典型的 access.log 消息和 squid.conf 的相關部分。

1450150756.680    131 10.64.9.57 TCP_MISS/200 183815 GET 
http://mirror.crucial.com.au/fedora/linux/updates/23/x86_64/l/libquadmath-5.3.1-2.fc23.x86_64.rpm - 
FIRSTUP_PARENT/[parent-proxy-url] application/x-redhat-package-manager 
[Host: mirror.crucial.com.au
User-Agent: dnf/1.1.4
Accept: */*
Proxy-Connection: Keep-Alive] 
[HTTP/1.1 200 OK
Expires: Sun, 13 Dec 2015 22:57:47 GMT
Server: nginx/1.8.0
Date: Tue, 15 Dec 2015 03:39:07 GMT
Content-Type: application/x-redhat-package-manager
Content-Length: 183182
Last-Modified: Thu, 10 Dec 2015 20:53:32 GMT
ETag: "5669e64c-2cb8e"
Age: 0
Connection: keep-alive
Proxy-Connection: keep-alive
Via: 1.1 NZ8KS49CH
X-Cache-Lookup: HIT from NZ8KS49CH (M86 Security Proxy Cache)
X-Cache: HIT from NZ8KS49CH (M86 Security Proxy Cache)
X-WebMarshal-RequestID: C3F30882-D914-481F-8E60-2AD367A4A046]

這是conf:

cache_peer [parent-proxy-url] parent 8081 0 no-query no-digest proxy-only default login=[user]:[pass]

acl all src 0.0.0.0/0 ::/0
never_direct allow all
maximum_object_size 4096 MB
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 10000 16 256

# Leave coredumps in the first cache dir
#coredump_dir /var/spool/squid

cache_replacement_policy heap LFUDA

acl filetype urlpath_regex \.rpm
cache allow filetype
send_hit allow filetype
cache deny all

#
# Add any of your own refresh_pattern entries above these.
#
refresh_pattern -i .rpm$ 129600 100% 129600 refresh-ims override-expire
refresh_pattern -i .iso$ 129600 100% 129600 refresh-ims override-expire
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

我還注意到,當我設置它以便通過 squid 引導我的網路瀏覽器時,有些東西被記憶體了。一旦我只設置了 dnf,就沒有任何記憶體了。

弄清楚了。cache_peer 行包含“proxy-only”,它會阻止 squid 記憶體來自該對等點的任何內容。刪除“僅代理”術語完全解決了這個問題。我想我是從網上的一些教程中學到的,它一定是在嘗試與我不同的東西。

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