我的清漆缓存工作正常,除了每隔几个小时就会出现烦人的问题,后端探测器会报告我的4个后端中的3个。因此网站无法打开,显然会报告503。
奇怪的是每次发生这种情况时,我都会去Domain Dossier(http://centralops.net/co/DomainDossier.aspx)并进行"服务扫描"。扫描将显示503错误,但显示所有标题,只有X-Varnish有一个数字,显然缓存不起作用....
但是在我完成"服务扫描"之后,我去做了一个" varnishadm backend.list",我将100%的时间看到数字计数开始从"生病0/10"最后"健康10/10"。就像我说的那样,我通常会有3个病区,所以我做了#34;服务扫描"再次为另外两个生病的域名,他们每个人都成功探测ping并重新开始工作....
任何人都有同样的问题吗?
Apache:监听domain.ip1:8080监听domain.ip2:8080监听domain.ip4:8080(domain2使用与domain3相同的ip)
这是default.vcl:
backend domain1 {
.host = "domain.ip1";
.port = "8080";
.connect_timeout = 600s;
.saintmode_threshold = 0;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
.probe = {
.url = "/favicon.ico";
.interval = 10s;
.timeout = 3s;
.window = 10;
.threshold = 3;
# .initial = 3;
.expected_response = 301;
}
}
backend domain2 {
.host = "domain.ip2";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
.probe = {
.url = "/favicon.ico";
.interval = 10s;
.timeout = 3s;
.window = 10;
.threshold = 3;
# .initial = 3;
.expected_response = 200;
}
}
backend domain3 {
.host = "domain.ip3";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
.probe = {
.url = "/favicon.ico";
.interval = 10s;
.timeout = 3s;
.window = 10;
.threshold = 3;
# .initial = 3;
.expected_response = 200;
}
}
backend domain4 {
.host = "domain.ip4";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
.probe = {
.url = "/favicon.ico";
.interval = 10s;
.timeout = 3s;
.window = 10;
.threshold = 3;
# .initial = 3;
.expected_response = 200;
}
}
sub vcl_recv {
if (req.http.host ~ "^www.domain1.com") {
set req.http.host = "www.domain1.com";
set req.backend = domain1;
return (lookup);
}
if (req.http.host ~ "^www.domain2.com") {
set req.http.host = "www.domain2.com";
set req.backend = domain2;
return (lookup);
}
if (req.http.host ~ "^www.domain3.com") {
set req.http.host = "www.domain3.com";
set req.backend = domain3;
return (lookup);
}
if (req.http.host ~ "^www.domain4.com") {
set req.http.host = "www.domain4.com";
set req.backend = domain4;
return (lookup);
}
}
当后端健康时,探测器10/10,标题如下:
HTTP/1.1 301 Moved Permanently
Server: Apache
Location: http://www.domain1.com/
Cache-Control: max-age=900
Expires: Tue, 24 Jun 2014 07:30:25 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 304
Accept-Ranges: bytes
Date: Tue, 24 Jun 2014 07:15:25 GMT
X-Varnish: 1997501007
Age: 0
Via: 1.1 varnish
Connection: close
OR
HTTP/1.1 301 Moved Permanently
Server: Apache
Location: http://www.domain1.com/
Cache-Control: max-age=900
Expires: Tue, 24 Jun 2014 07:30:25 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 304
Accept-Ranges: bytes
Date: Tue, 24 Jun 2014 07:18:53 GMT
X-Varnish: 1997501047 1997501007
Age: 208
Via: 1.1 varnish
Connection: close
当后端生病时,我使用Domain Dossier获取标题,它将显示如下:
HTTP/1.1 503
Server: Apache
Location: http://www.domain1.com/
Cache-Control: max-age=900
Expires: Tue, 24 Jun 2014 07:30:25 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 304
Accept-Ranges: bytes
Date: Tue, 24 Jun 2014 07:15:25 GMT
X-Varnish: 1997501007
Age: 0
Via: 1.1 varnish
Connection: close
/ etc / sysconfig / varnish文件:
DAEMON_OPTS="-a :80\
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,512m \
-p ping_interval=10 \
-p thread_pools=2 \
-p thread_pool_max=8000 \
-p thread_pool_min=100 \
-p thread_pool_add_delay=2 \
-p sess_timeout=60 \
-p cli_timeout=120 \
"