歡迎您光臨本站 註冊首頁

squid集群問題緊急救助!!

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

squid集群問題緊急救助!!

目前公司為了開展站全網業務,需要全網用戶訪問速度加快,我設計了如下squid集群,請看如下配置文件!

現在可以提供給各地sibling的父cache有4個,分別在不同的網路裡面。子cache結點有6個,之間以同級peer來獲取數據。

運行后發現如下問題

訪問子子cache節點的時候,數據沒有直接從緩存裡面讀取也沒有從設定的鄰居cache站點取,而是先訪問parnet的伺服器,但是Parnet的伺服器squid無法進行判斷那個線路是最優化的。造成用戶訪問速度較慢。這問題在高峰期很嚴重了,跪求高手來幫忙!

parnet中的squid.conf文件
# NETWORK OPTIONS
# -----------------------------------------------------------------------------
http_port 111.111.111.111:80 vhost vport
icp_port 3130
cache_peer 111.111.111.111 parent 3180 0 no-query originserver no-netdb-exchange  name=web1 round-robin
cache_peer 222.222.222.222parent 3180 0 no-query originserver no-netdb-exchange name=web2 round-robin
cache_peer 333.333.333.333 parent 3180 0 no-query originserver no-netdb-exchange name=web3 round-robin
cache_peer 444.444.444.444 parent 3180 0 no-query originserver no-netdb-exchange name=web4 round-robin

# 說明 3180埠為apache開放的埠

cache_peer 111.111.111.111 sibling 80 3130 name=cache1
cache_peer 222.222.222.222 sibling 80 3130 name=cache2
cache_peer 333.333.333.333 sibling 80 3130 name=cache3
cache_peer 444.444.444.444 sibling 80 3130 name=cache4
cache_peer 555.555.555.555 sibling 80 3130 name=cache5
cache_peer 666.666.666.666 sibling 80 3130 name=cache6

# 說明 80埠為 squid對外的埠 3130 為icp埠
cache_peer_domain web1  www.xxx.cn      
cache_peer_domain web2  www.xxx.cn      
cache_peer_domain web3  www.xxx.cn
cache_peer_domain web4  www.xxx.cn


# OPTIONS WHICH AFFECT THE NEIGHBOR SELECTION ALGORITHM
# -----------------------------------------------------------------------------
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?\.php
cache deny QUERY
acl OverConnLimit maxconn 16
http_access deny OverConnLimit
acl allowsite dstdomain www.xxxl.cn
http_access deny !allowsite

# OPTIONS WHICH AFFECT THE CACHE SIZE
# -----------------------------------------------------------------------------
cache_mem 512 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 4096 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 80 KB

# LOGFILE PATHNAMES AND CACHE DIRECTORIES
# -----------------------------------------------------------------------------
cache_dir ufs /home/cache 1024 56 256
#access_log /home/squid_log/access.log squid
cache_log /home/squid_log/cache.log
cache_store_log  none
emulate_httpd_log on
pid_filename /usr/local/squid/var/logs/squid.pid

# ACCESS CONTROLS
# -----------------------------------------------------------------------------
acl all src 0.0.0.0/0.0.0.0
acl Safe_ports port 80
acl Safe_ports port 3130
http_access allow all
http_access deny !Safe_ports
http_reply_access allow all
icp_access allow all
cache_peer_access cache1 allow all
cache_peer_access cache2 allow all
cache_peer_access cache3 allow all
cache_peer_access cache4 allow all
cache_peer_access cache5 allow all
cache_peer_access cache6 allow all

# ADMINISTRATIVE PARAMETERS
# -----------------------------------------------------------------------------
cache_mgr webmaster
cache_effective_user squid
cache_effective_group squid
visible_hostname squid_parent1.xxx.cn

# MISCELLANEOUS
# -----------------------------------------------------------------------------
logfile_rotate 0
tcp_recv_bufsize 65535 bytes
#error_directory /home/error_dir

# DELAY POOL PARAMETERS (all require DELAY_POOLS compilation option)
# -----------------------------------------------------------------------------
coredump_dir /home/cache
client_persistent_connections off
server_persistent_connections on

sibling中的squid.conf文件
http_port 555.555.555.555:80 vhost vport
icp_port 3130
cache_peer 111.111.111.111 parent 3180 0 no-query originserver no-netdb-exchange  name=web1 default


# 說明 3180埠為apache開放的埠

cache_peer 111.111.111.111 sibling 80 3130 name=cache1
cache_peer 222.222.222.222 sibling 80 3130 name=cache2
cache_peer 333.333.333.333 sibling 80 3130 name=cache3
cache_peer 444.444.444.444 sibling 80 3130 name=cache4
cache_peer 555.555.555.555 sibling 80 3130 name=cache5
cache_peer 666.666.666.666 sibling 80 3130 name=cache6

# 說明 80埠為 squid對外的埠 3130 為icp埠
cache_peer_domain web1  www.xxx.cn      


# OPTIONS WHICH AFFECT THE NEIGHBOR SELECTION ALGORITHM
# -----------------------------------------------------------------------------
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?\.php
cache deny QUERY
acl OverConnLimit maxconn 16
http_access deny OverConnLimit
acl allowsite dstdomain www.xxxl.cn
http_access deny !allowsite

# OPTIONS WHICH AFFECT THE CACHE SIZE
# -----------------------------------------------------------------------------
cache_mem 512 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 4096 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 80 KB

# LOGFILE PATHNAMES AND CACHE DIRECTORIES
# -----------------------------------------------------------------------------
cache_dir ufs /home/cache 1024 56 256
#access_log /home/squid_log/access.log squid
cache_log /home/squid_log/cache.log
cache_store_log  none
emulate_httpd_log on
pid_filename /usr/local/squid/var/logs/squid.pid

# ACCESS CONTROLS
# -----------------------------------------------------------------------------
acl all src 0.0.0.0/0.0.0.0
acl Safe_ports port 80
acl Safe_ports port 3130
http_access allow all
http_access deny !Safe_ports
http_reply_access allow all
icp_access allow all
cache_peer_access cache1 allow all
cache_peer_access cache2 allow all
cache_peer_access cache3 allow all
cache_peer_access cache4 allow all
cache_peer_access cache5 allow all
cache_peer_access cache6 allow all

# ADMINISTRATIVE PARAMETERS
# -----------------------------------------------------------------------------
cache_mgr webmaster
cache_effective_user squid
cache_effective_group squid
visible_hostname squid5.xxx.cn

# MISCELLANEOUS
# -----------------------------------------------------------------------------
logfile_rotate 0
tcp_recv_bufsize 65535 bytes
#error_directory /home/error_dir

# DELAY POOL PARAMETERS (all require DELAY_POOLS compilation option)
# -----------------------------------------------------------------------------
coredump_dir /home/cache
client_persistent_connections off
server_persistent_connections on
《解決方案》

cache選擇的順序

選擇新鮮cache目標的優先順序是:

local cache
parent
sibling
direct
你可以看彭勇華的http://squidcn.spaces.live.com/blog/cns!B49104BB65206A10!136.entry
這篇文章
《解決方案》

回復 #1 mysbn 的帖子

好的項目,多多學習呀
《解決方案》

回復 #2 liuhanzhao 的帖子

1. 當 Squid Server 沒有資料時,會先向 Sibling 的 Squid Server 要資料,如果 Sibling 沒資料,就跳過它直接向 Parent 要。
2. 向 Parent 要資料,然後一直等,直到 Parent 給它資料為止(Parent 自己有的資料或上 internet 去拿)。
3. 沒有 Parent 時,就自己上 internet 去拿。
4. 如果這三者都拿不到資料,才向用戶端回報拿不到資料。

[火星人 ] squid集群問題緊急救助!!已經有612次圍觀

http://coctec.com/docs/service/show-post-7000.html