【问题标题】:Varnish 503 Error/No backend connectionVarnish 503 错误/无后端连接
【发布时间】:2016-06-19 08:43:09
【问题描述】:

我目前正在为我的网站使用 varnish,以前它运行良好,没有任何问题,但今天我在尝试访问我的网站的任何部分时得到的只是 503 错误,这就是我从 varnishlog 得到的.

3 VCL_return   c pass                                                                                            
3 FetchError   c no backend connection                                                                           
3 VCL_call     c error                                                                                           
3 VCL_return   c deliver                                                                                         
3 VCL_call     c deliver                                                                                         
3 VCL_return   c deliver                                                                                         
3 TxProtocol   c HTTP/1.1                                                                                        
3 TxStatus     c 503                                                                                             
3 TxResponse   c Service Unavailable                                                                             
3 TxHeader     c Server: Varnish                                                                                 
3 TxHeader     c Retry-After: 0                                                                                  
3 TxHeader     c Content-Type: text/html; charset=utf-8                                                          
3 TxHeader     c Content-Length: 418                                                                             
3 TxHeader     c Date: Sat, 05 Mar 2016 15:25:44 GMT                                                             
3 TxHeader     c X-Varnish: 765008569                                                                            
3 TxHeader     c Age: 0                                                                                          
3 TxHeader     c Via: 1.1 varnish                                                                                
3 TxHeader     c Connection: close                                                                               
3 Length       c 418                                                                                             
3 ReqEnd       c 765008569 1457191544.916952610 1457191544.917085171 0.000094652 0.000080585 0.000051975         
3 SessionClose c error                                                                                           
3 StatSess     c 185.106.92.245 33848 0 1 1 0 1 0 234 418  

这是我对 vcl 的配置

backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 1.5s;
.first_byte_timeout = 45s;
.between_bytes_timeout = 30s;
.probe = {
    .url ="/";
    .timeout = 34ms;
    .interval = 1s;
    .window = 10;
    .threshold = 8;
    }
}

sub vcl_recv
{
    # Set Grace Time to one hour
    set req.grace = 1h;
}

sub vcl_fetch
{
    # Set the TTL for cache object to five minutes
    set beresp.ttl = 5m;

    # Set Grace Time to one hour
    set beresp.grace = 1h;
}

我尝试了任何我找不到的解决方案,但都没有改善这种情况,我对此的了解也仅限于此。任何帮助将不胜感激。

【问题讨论】:

  • 你能发布“netstat -ntlp”的执行吗?

标签: caching varnish varnish-vcl


【解决方案1】:

在您的探测设置中,您的超时时间很短 34ms

.probe = {
    .url ="/";
    .timeout = 34ms;
    .interval = 1s;
    .window = 10;
    .threshold = 8;
    }

您确定您的网站加载速度如此之快吗?如果没有,Varnish 会将后端主机标记为关闭,因此也会返回错误 no backend connection

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-17
    • 2021-07-29
    • 2020-06-03
    • 1970-01-01
    • 2013-04-12
    • 2012-06-16
    • 2014-04-28
    • 2013-12-03
    相关资源
    最近更新 更多