修改(1): " .timeout"价值似乎没有任何影响。 " 503后端提取失败"错误立即显示
原始说明: 我对清漆很新。任何帮助表示赞赏。每次我尝试使用Varnish调用我的网页时,我都会收到以下错误:
<body>
<h1>Error 503 Backend fetch failed</h1>
<p>Backend fetch failed</p>
<h3>Guru Meditation:</h3>
<p>XID: 3</p>
<hr>
<p>Varnish cache server</p>
</body>
后台::我有一个文件index.php:
以下作品:
curl --header "Host: serverx.dev" 192.168.56.10:8080/index.php
以下不起作用并抛出&#34;后端提取失败&#34;错误:
curl --header "Host: serverx.dev" 192.168.56.10:80/index.php
我使用以下内容:
Virtualbox 5.0.32 r112930
Host operating system: Windows 7 (64-bit)
Guest operating system: Debian Jessie (minimal install)
Apache2 -----port 8080
varnish-4.1.5 revision 2c82b1c -----port 80
default.vcl:
vcl 4.0;
# import default varnish library
import std;
import directors;
backend server1 {
.host = "192.168.56.10";
.port = "8080";
.probe = {
.url = "/robots.txt";
.interval = 5s;
.timeout = 50s;
.window = 5;
.threshold = 3;
}
}
sub vcl_init {
new cluster = directors.round_robin();
cluster.add_backend(server1);
}
以下是当前的清漆状态:
root@debian:/etc/varnish# ps -ef | grep varnish
varnish 4210 1 0 11:26 ? 00:00:00 /usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
vcache 4211 4210 0 11:26 ? 00:00:00 /usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
root 4632 1470 0 11:40 pts/0 00:00:00 grep varnish
还有:
root@debian:/etc/varnish# netstat -anp | grep varnish
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 4210/varnishd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4210/varnishd
tcp6 0 0 ::1:6082 :::* LISTEN 4210/varnishd
tcp6 0 0 :::80 :::* LISTEN 4210/varnishd
unix 2 [ ] DGRAM 35213 4210/varnishd
的Apache2:
root@debian:/etc/varnish# netstat -anp | grep apache2
tcp6 0 0 :::443 :::* LISTEN 4461/apache2
tcp6 0 0 :::8080 :::* LISTEN 4461/apache2
Varnishlog提供以下输出
- BereqHeader X-Varnish: 51
- VCL_call BACKEND_FETCH
- VCL_return fetch
- FetchError Director cluster returned no backend
- FetchError No backend
- Timestamp Beresp: 1490091185.165509 0.000027 0.000027
- Timestamp Error: 1490091185.165513 0.000030 0.000004
- BerespProtocol HTTP/1.1
- BerespStatus 503
- BerespReason Service Unavailable
- BerespReason Backend fetch failed
- BerespHeader Date: Tue, 21 Mar 2017 10:13:05 GMT
- BerespHeader Server: Varnish
- VCL_call BACKEND_ERROR
我很乐意提供更多信息。
答案 0 :(得分:0)
问题似乎出现在default.vcl中。 在.probe中更改.url值后,varnish正常工作。
<强>之前:强>
backend server1 {
.host = "192.168.56.10";
.port = "8080";
.probe = {
.url = "/robots.txt";
.interval = 5s;
.timeout = 50s;
.window = 5;
.threshold = 3;
}
}
现在:(这个有效)
backend server1 {
.host = "192.168.56.10";
.port = "8080";
.probe = {
.url = "/"; -------The change was made here
.interval = 5s;
.timeout = 50s;
.window = 5;
.threshold = 3;
}
}