VCLのbackend
cache対称にするoriginの設定
docs
backend
code:vcl
backend default {
.host = "httpd";
.port = "80";
.connect_timeout = 1s;
.first_byte_timeout = 15s;
}
backendに名前をつける
.host
originのhost名
IPアドレスのときもある
IPアドレスを指定したほうが良い
/mrsekut-book-4297119250/687
.port
originのport名
.connect_timeout
コネクションに接続するまでのタイムアウト
.first_byte_timeout
最初の byte を取得するまでのタイムアウト
.max_connections
backendの同時接続数
varnish : backend = 1 : nのnのこと
.probe
https://www.varnish-software.com/developers/tutorials/example-vcl-template/#health-probe
originのhealth状態を監視する
定期的にoriginにreqを投げる
vmod_directorsでloadbalancingするときとかに使う
定義済みのVCLのprobeを指定してもいい
code:vcl
probe healthcheck {...}
backend hoge {
.probe=healthcheck;
}
呼び出す
code:vcl
sub vcl_recv {
if (client.ip == "222.222.222.xxx"){
set req.backend = www1;
}
}
常にreq.backendと呼び出すの #??
参考
Example VCL template - Varnish Developer Portal
VCLの全体感を掴む記事