【问题标题】:Does vcl.load include related files?vcl.load 是否包含相关文件?
【发布时间】:2020-11-02 15:50:11
【问题描述】:

Varnish 中,我们可以加载特定的配置文件并告诉 Varnish 使用它。

例如,一个 bash 脚本:

#!/bin/bash

# Generate a unique timestamp ID for this version of the VCL
TIME=$(date +%s)

# Load the file into memory
varnishadm vcl.load varnish_$TIME /etc/varnish/default.vcl

# Active this Varnish config
varnishadm vcl.use varnish_$TIME

运行:

$ ./varnishconf 
VCL compiled.

VCL 'varnish_1604136350' now active

但是,如果default.vcl 包含其他 vcl 文件,不清楚vcl.use 是否也会使用这些包含文件的那个版本?

例如在default.vcl:

include "includes/backend.vcl";

backends.vcl 状态是否包含在该vcl.use 版本中?

varnish 是否包含来自 vcl.load 的依赖包含文件到 vcl.use 中?

【问题讨论】:

    标签: varnish varnish-vcl


    【解决方案1】:

    是的,在执行vcl.load 时,Varnish 会处理完整的 VCL 文件。

    varnishadm vcl.load 触发 VCC,即编译器。启动varnishd时会触发相同的VCC,所以这里并没有什么区别。

    关于包含文件:当 VCC 线程启动时,每个include 语句都会被解析,并且它所引用的内容被粘贴到内联。解析完所有包含后,Varnish 可以开始标记化并编译完整的 VCL。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-15
      • 1970-01-01
      • 1970-01-01
      • 2012-09-28
      • 1970-01-01
      • 2012-11-10
      • 2015-11-08
      • 2011-07-20
      相关资源
      最近更新 更多