我已按照以下说明在我们的暂存站点上安装了 Varnish Turpintine Magento-Turpintine 维基.

我们的网站使用的是 Ubuntu 14.04、NGINX、varnish-4.0.3m、Turpentine v0.6.5、Magento 1.9.2。

这些是我的 DAEMON_OPTS/etc/default/varnish

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -p cli_buffer=16384 \
             -p feature=+esi_ignore_other_elements \
             -p vcc_allow_inline_c=on \
             -s malloc,256m"

我成功安装了松节油模块,仅使用以下命令真正更改了 Secret Varnish 身份验证密钥的配置 \n 附加 URL 黑名单和启用调试信息。

当我尝试保存配置时,出现以下错误:

Failed to apply the VCL to 127.0.0.1:6082: Got unexpected response code from Varnish: 106 Message from VCC-compiler: directors are now in directors VMOD. ('input' Line 27 Pos 1) director default round-robin { ########---------------------- Running VCC-compiler failed, exited with 2 VCL compilation failed

这就是我在松节油生成中得到的 var/default.vcl 文件:

vcl 4.0;
C{
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
static pthread_mutex_t lrand_mutex = PTHREAD_MUTEX_INITIALIZER;
void generate_uuid(char* buf) {
pthread_mutex_lock(&lrand_mutex);
long a = lrand48();
long b = lrand48();
long c = lrand48();
long d = lrand48();
pthread_mutex_unlock(&lrand_mutex);
sprintf(buf, "frontend=%08lx%04lx%04lx%04lx%04lx%08lx",
a,
b & 0xffff,
(b & ((long)0x0fff0000) >> 16) | 0x4000,
(c & 0x0fff) | 0x8000,
(c & (long)0xffff0000) >> 16,
d
);
return;
}
}C
import std;
director default round-robin {
{
.backend = {
.host = "127.0.0.1";
.port = "8080";
.first_byte_timeout = 300s;
.between_bytes_timeout = 300s;
}
}
}
director admin round-robin {
{
.backend = {
.host = "127.0.0.1";
.port = "8080";
.first_byte_timeout = 21600s;
.between_bytes_timeout = 21600s;
}
}

我似乎能够通过创建来解决这个问题 custom_include.vcl 文件来自 version-4.vcl 因为它丢失了

cp app/code/community/Nexcessnet/Turpentine/misc/version-4.vcl app/code/community/Nexcessnet/Turpentine/misc/custom_include.vcl

但现在当我尝试保存配置时出现新错误:

Failed to apply the VCL to 127.0.0.1:6082: Varnish data to write over length limit by 749 characters

这似乎与 -p cli_buffer=16384 我在其中设置的 DAEMON_OPTS/etc/default/varnish. 。当我尝试增加此值时,我仍然遇到相同的错误,但限制不同。

Failed to apply the VCL to 127.0.0.1:6082: Varnish data to write over length limit by 8941 characters.

我什么都没有 magento/var/log/ 或者 /var/log/varnish/ 对于清漆。我尝试检查 Varnish Admin,看看 cli_buffer 是否有任何问题,但没有看到任何值得注意的地方。

$ sudo varnishadm
varnish> param.show cli_buffer
200        
cli_buffer
        Value is: 16k [bytes]
        Default is: 8k
        Minimum is: 4k

        Size of buffer for CLI command input.
        You may need to increase this if you have big VCL files and use
        the vcl.inline CLI command.
        NB: Must be specified with -p to have effect.

预先感谢您的任何建议。

有帮助吗?

解决方案 2

我似乎通过应用我发现的修复程序来解决这个问题 GitHub 票证 915.

首先,我为第一个错误应用的修复程序具有误导性,因此我删除了我创建的文件。

rm app/code/community/Nexcessnet/Turpentine/misc/custom_include.vcl

然后我合并了 Magento-Turpintine 存储库的开发分支 按照我的 Magento 项目的建议 GitHub 票证 915.

现在,当我保存 Turpintine 配置/应用 Varnish 配置时,我没有收到任何错误消息。

尽管该网站似乎没有加快很多速度,但我如何确保清漆按预期工作。

更新我能够通过运行 varnishstat 来确保 Varnish 正常工作,如果 Hitrate avg 大于 0,则意味着缓存正在被命中。

其他提示

感谢分享。我刚刚安装了最新版本 devel 分支来解决一个非常相似的问题。要检查 Varnish 是否正在缓存,如果您有权访问服务器,可以使用以下任一 varnishtop 命令。

/usr/bin/varnishtop -i RxURL
/usr/bin/varnishtop -i RxHeader -C -I \^HOST
许可以下: CC-BY-SA归因
scroll top