gpt4 book ai didi

Varnish 无法识别 req.grace 变量

转载 作者:行者123 更新时间:2023-12-04 05:09:30 25 4
gpt4 key购买 nike

我全新安装了 Slackware 64 14 位,并查看了 Varnish installation documentation我安装了所有依赖项并编译了 varnish,没有错误(make check 通过了所有测试)

然而,当我尝试使用

varnishd -f /etc/varnish/user.vcl -s malloc,4G -T 127.0.0.1:2000

我得到
Message from VCC-compiler:
Unknown variable 'req.grace'
At: ('input' Line 17 Pos 9)
set req.grace = 15s;
--------#########-------

Running VCC-compiler failed, exit 1

VCL compilation failed

我的很简单 /etc/varnish/ucer.vcl文件如下所示:
vcl 4.0;

# set default backend if no server cluster specified
backend default {
.host = "127.0.0.1";
.port = "8080";
.probe = {
.url = "/";
.timeout = 34ms;
.interval = 1s;
.window = 10;
.threshold = 8;
}
}

sub vcl_recv {
set req.grace = 15s;
}

sub vcl_fetch {
set beresp.grace = 30m;
}

变量名称与 this example 相同.
varnishd -V返回
varnishd (varnish-4.0.0 revision 2acedeb)

通过删除 sub vcl_recv 和 sub vcl_fetch (仅使用后端默认值) Varnish 工作正常,我可以看到它的标题,但我需要编辑 VCL 文件。

有任何想法吗?

最佳答案

您正在使用 Varnish 4.0.0,它需要从您的 VCL 代码所基于的 3.0 格式进行更新。

req.grace 消失了(你通常不需要它)并且 vcl_fetch 现在被称为 vcl_backend_response。

查看升级文档:https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html

关于 Varnish 无法识别 req.grace 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23284764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com