Varnish:503 后端获取失败/Varnishlog 说:FetchError 没有后端
Varnish:503 Backend fetch failed / Varnishlog says: FetchError No backend
编辑(1):
“.timeout”值似乎没有任何作用。立即显示“503 Backend fetch failed”错误
原文解释:
我对清漆很陌生。任何帮助表示赞赏。每次尝试使用 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
以下不起作用并抛出 "Backend fetch failed" 错误:
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
我很乐意提供更多信息。
问题似乎出在 default.vcl。
更改 .url 中的值后 .probe ,清漆正常工作。
之前:
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;
}
}
编辑(1): “.timeout”值似乎没有任何作用。立即显示“503 Backend fetch failed”错误
原文解释: 我对清漆很陌生。任何帮助表示赞赏。每次尝试使用 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
以下不起作用并抛出 "Backend fetch failed" 错误:
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
我很乐意提供更多信息。
问题似乎出在 default.vcl。 更改 .url 中的值后 .probe ,清漆正常工作。
之前:
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;
}
}