{"id":2332,"date":"2016-10-03T23:49:55","date_gmt":"2016-10-03T14:49:55","guid":{"rendered":"http:\/\/blog.xcir.net\/?p=2332"},"modified":"2016-10-03T23:58:40","modified_gmt":"2016-10-03T14:58:40","slug":"varnish5-0-0%e3%81%8c%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9%e3%81%95%e3%82%8c%e3%81%be%e3%81%97%e3%81%9f","status":"publish","type":"post","link":"http:\/\/blog.xcir.net\/?p=2332","title":{"rendered":"Varnish5.0.0\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f"},"content":{"rendered":"<p>\u4e8c\u5e74\u3076\u308a\u3050\u3089\u3044\u306b\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u66f4\u65b0\u3055\u308c\u307e\u3057\u305f\u3002<a href=\"https:\/\/www.varnish-cache.org\/releases\/rel5.0.0.html#rel5-0-0\">[\u516c\u5f0f\u30ea\u30ea\u30fc\u30b9]<\/a>\u3000<a href=\"https:\/\/repo.varnish-cache.org\/pkg\/5.0.0\/\">[\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9]<\/a><br \/>\n\u4eca\u56de\u306e\u76ee\u7389\u6a5f\u80fd\u3068\u3057\u3066HTTP\/2\u5bfe\u5fdc\u3068Director\u306eConsistent Hash\u5bfe\u5fdc\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u306a\u306b\u306f\u3068\u3082\u3042\u308c\u3001\u3068\u308a\u3042\u3048\u305aHTTP\/2\u3092\u4f7f\u3046\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3092\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>Hitch1.4.0+Varnish5\u3067HTTP\/2\u3092\u4f7f\u3046<\/h3>\n<p>Varnish\u306f\u3088\u304f\u77e5\u3089\u308c\u3066\u308b\u3088\u3046\u306b<a href=\"https:\/\/www.varnish-cache.org\/docs\/trunk\/phk\/ssl_again.html\">HTTPS\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/a><br \/>\nHTTP\/2\u306b\u5bfe\u5fdc\u3057\u305f\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u304a\u3044\u3066\u3082\u3001\u3084\u306f\u308a\u672c\u4f53\u3067\u306f\u5bfe\u5fdc\u3092\u3057\u3066\u3044\u307e\u305b\u3093\u3002<br \/>\n\u305d\u306e\u305f\u3081\u901a\u5e38\u306e\u30d6\u30e9\u30a6\u30b6\u304b\u3089Varnish\u306b\u5bfe\u3057\u3066HTTP\/2\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306b\u306fTLS\u3092\u89e3\u304b\u306a\u304f\u3066\u306f\u884c\u3051\u307e\u305b\u3093\u3002<br \/>\n\u4eca\u56de\u306fVarnishSoftware\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308bHitch\u3092\u5229\u7528\u3057\u307e\u3059\u3002<br \/>\n\u306a\u304a\u3001HTTP\/2\u3092\u5229\u7528\u3059\u308b\u306b\u306f1.4.0\u4ee5\u964d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u5fc5\u8981\u3067\u3059\u3002<br \/>\n\u307e\u305f\u3001\u4e00\u90e8\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u79c1\u304c\u5229\u7528\u3057\u3066\u3044\u308bUbuntu 16.04\u5411\u3051\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306f\u306a\u304b\u3063\u305f\u306e\u3067\u30bd\u30fc\u30b9\u304b\u3089build\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>Hitch\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/strong><br \/>\n<a href=\"https:\/\/github.com\/varnish\/hitch\/blob\/master\/docs\/installation.md\">\u516c\u5f0f\u624b\u9806<\/a>\u3092\u53c2\u8003\u306b\u884c\u3044\u307e\u3059<\/p>\n<pre class=\"brush: shell; \">\n\r\nsudo apt-get install libev-dev libssl-dev automake python-docutils flex bison pkg-config\r\ngit clone https:\/\/github.com\/varnish\/hitch.git\r\ncd hitch\r\n.\/bootstrap\r\n.\/configure --prefix=\/opt\/hitch\/\r\nmake\r\nsudo make install\r\n\n<\/pre>\n<p>\u3053\u308c\u3060\u3051\u3067\u3059\u3002(prefix\u306f\u304a\u597d\u304d\u306a\u3068\u3053\u308d\u306b\u3067\u3082\uff09<br \/>\n\u306a\u304a\u3001HTTP\/2\u3092\u4f7f\u3046\u306b\u306fNPN\u3082\u3057\u304f\u306fALPN\u306e\u30b5\u30dd\u30fc\u30c8\u304c\u5fc5\u8981\u3067\u3059\u3002<br \/>\nNPN\u306fOpenSSL1.0.1\u3001ALPN\u306e\u5834\u5408\u306f1.0.2\u304c\u5fc5\u8981\u3067\u3059\u304c\u3001\u65e2\u306bChrome\u3067\u306f\u4eca\u5e74\u306e6\u6708\u3054\u308d\u306bNPN\u3067\u306eHTTP\/2\u30b5\u30dd\u30fc\u30c8\u306f\u6253\u3061\u5207\u3089\u308cALPN\u306e\u307f\u3067\u306e\u30b5\u30dd\u30fc\u30c8\u3068\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u305d\u306e\u305f\u3081\u5b9f\u8ceaHTTP\/2\u3092\u5229\u7528\u3059\u308b\u306b\u306fALPN\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3068\u308a\u3042\u3048\u305a\u78ba\u8a8d\u3059\u308b\u7a0b\u5ea6\u3067\u3042\u308c\u3070\u3001FireFox49\u306fNPN\u3067\u3082\u63a5\u7d9a\u3067\u304d\u308b\u306e\u30671.0.1\u3067\u3082\u554f\u984c\u306f\u306a\u3044\u3067\u3059\u3002<\/p>\n<p><strong>Hitch\u306e\u8a2d\u5b9a<\/strong><\/p>\n<pre class=\"brush: plain; \">\n\r\nHTTPS:443\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000HTTP:80\r\n   \u2193\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u2193\r\nHitch:443--(localhost:81)--&gt;Varnish:80\r\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u2193\r\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 Origin\r\n\n<\/pre>\n<p>\u4eca\u56de\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u69cb\u6210\u3057\u307e\u3059\u3002<br \/>\n\u307e\u305a\u306fHitch\u306e\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; \">\n\r\n#\/etc\/hitch\/hitch.conf\r\nfrontend       = &quot;[*]:443&quot;\r\nciphers        = &quot;ECDHE+RSAGCM:ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:EECDH+HIGH:EDH+HIGH:HIGH:+3DES:!RC4:!MD5:!aNULL:!eNULL:!LOW:!EXP:!PSK:!SRP:!DSS:!KRB5:!DH&quot;\r\nbackend        = &quot;[127.0.0.1]:81&quot;\r\nwrite-proxy-v2 = on\r\nworkers        = 2\r\nbacklog        = 1024\r\nkeepalive      = 3600\r\nsyslog         = on\r\nuser           = &quot;nobody&quot;\r\ndaemon         = on\r\nalpn-protos    = &quot;h2,http\/1.1&quot;\r\npem-file       = &quot;\/etc\/hitch\/******.pem&quot;\r\n\n<\/pre>\n<p>ciphers\u3068\u304b\u306f\u5272\u3068\u9069\u5f53\u3067\u3059\u304c\u304d\u3061\u3093\u3068\u8a2d\u5b9a\u3057\u305f\u3044\u4eba\u306f<a href=\"https:\/\/mozilla.github.io\/server-side-tls\/ssl-config-generator\/\">\u3053\u3061\u3089\u3067\u8003\u3048\u308b<\/a>\u3068\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u306a\u304a\u3001hitch\u306epem-file\u306f<br \/>\n\u79d8\u5bc6\u9375 + \u8a3c\u660e\u66f8 + \u4e2d\u9593CA\u8a3c\u660e\u66f8 + dhparam<br \/>\n\u3067\u3059\u3002<br \/>\nLet&#8217;s Encrypt\u3067\u3084\u308b\u5834\u5408\u306f<br \/>\nprivkey.pem + fullchain.pem + dhparam<br \/>\n\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u3069\u3046\u3084\u3063\u3066\u8907\u6570\u306evhosts\u306b\u5bfe\u5fdc\u3059\u308b\u306e\u304b\u3068\u3044\u3046\u3068pem-file\u3092\u5217\u6319\u3057\u307e\u3059\u3002<br \/>\n\u3061\u306a\u307f\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u3082\u306e\u306f\u6700\u5f8c\u306b\u5b9a\u7fa9\u3055\u308c\u305f\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n<strong>Hitch\u306e\u8d77\u52d5<\/strong><\/p>\n<pre class=\"brush: shell; \">\n\r\n\/opt\/hitch\/sbin\/hitch --config=\/etc\/hitch\/hitch.conf\r\n\n<\/pre>\n<p>\u6b21\u306fVarnish\u306e\u8a2d\u5b9a\u3067\u3059\u3002<br \/>\n<strong>Varnish\u306e\u8a2d\u5b9a<\/strong><br \/>\n\u307e\u305a\u306fListen\u306e\u6307\u5b9a\u3092\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u30dd\u30fc\u30c880\u3067\u901a\u5e38\u306eHTTP\u3092\u53d7\u4ed8\u3057\u306681\u3067PROXY\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u53d7\u4ed8\u3057\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u306e\u8a2d\u5b9a\u306f\u3053\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; \">\n\r\n-a :80 \\\r\n-a 127.0.0.1:81,PROXY \\\r\n\n<\/pre>\n<p>\u307e\u305f\u3001HTTP\/2\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u6709\u52b9\u306b\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<br \/>\n\u305d\u306e\u305f\u3081feature\u3067http2\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\nvarnishadm\u304b\u3089\u8a2d\u5b9a\u3059\u308b\u5834\u5408\u306f<\/p>\n<pre class=\"brush: shell; \">\n\r\nroot@proxy02:~# varnishadm param.set feature +http2\r\n\r\nroot@proxy02:~# varnishadm param.show feature\r\nfeature\r\n        Value is: +esi_disable_xml_check,+http2\r\n        Default is: none\r\n\r\n        Enable\/Disable various minor features.\r\n           none                       Disable all features.\r\n\r\n        Use +\/- prefix to enable\/disable individual feature:\r\n           short_panic                Short panic message.\r\n           wait_silo                  Wait for persistent silo.\r\n           no_coredump                No coredumps.\r\n           esi_ignore_https           Treat HTTPS as HTTP in\r\n                                      ESI:includes\r\n           esi_disable_xml_check      Don&#039;t check of body looks like\r\n                                      XML\r\n           esi_ignore_other_elements  Ignore non-esi XML-elements\r\n           esi_remove_bom             Remove UTF-8 BOM\r\n           https_scheme               Also split https URIs\r\n           http2                      Support HTTP\/2 protocol\r\n\n<\/pre>\n<p>\u3067\u3059\u3002<br \/>\n\u8d77\u52d5\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u6307\u5b9a\u3059\u308b\u5834\u5408\u306f<\/p>\n<pre class=\"brush: plain; \">\n\r\n-p feature=+http2 \\\r\n\n<\/pre>\n<p>\u3092\u8ffd\u52a0\u3059\u308c\u3070\u826f\u3044\u3067\u3059\u3002<br \/>\n\u3053\u308c\u3067\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/p>\n<p><font color=\"#ff0000\">\u306a\u304a\u3001\u5f8c\u8ff0\u3057\u307e\u3059\u304c\u7d76\u5bfe\u672c\u756a\u74b0\u5883\u3067\u306f\u884c\u308f\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002<\/font><\/p>\n<p>\u305d\u308c\u3067\u306f\u3001HTTP\/2\u3067\u306e\u52d5\u4f5c\u306e\u3055\u305b\u304b\u305f\u3092\u7d39\u4ecb\u3057\u305f\u3068\u3053\u308d\u3067\u3001\u3044\u3064\u3082\u901a\u308a\u65b0\u6a5f\u80fd\u306a\u3069\u306e\u7d39\u4ecb\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h3>\u5168\u4f53\u7684\u306a\u8a71<\/h3>\n<p>\u904e\u53bb\u306e\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3092\u632f\u308a\u8fd4\u3063\u3066\u307f\u308b\u3068<br \/>\n2.1->3.0<\/p>\n<ul>\n<li>VMOD\u306e\u30b5\u30dd\u30fc\u30c8\u3068VCL\u6587\u6cd5\u306e\u6574\u7406<\/li>\n<\/ul>\n<p>3.0->4.0<\/p>\n<ul>\n<li>\u30ea\u30af\u30a8\u30b9\u30c8\u30fb\u30d5\u30a7\u30c3\u30c1\u30fb\u30ec\u30b9\u30dd\u30f3\u30b9\u3068\u3044\u3063\u305f\u4e00\u9023\u306e\u52d5\u4f5c\u3092Client\/Backend\u30b9\u30ec\u30c3\u30c9\u306b\u5206\u5272<\/li>\n<li>VCL\u306b\u30d0\u30fc\u30b8\u30e7\u30f3\u756a\u53f7\u4ed8\u4e0e\u3068\u30b9\u30ec\u30c3\u30c9\u5206\u5272\u306b\u5bfe\u5fdc\u3059\u308b\u305f\u3081\u306e\u5909\u66f4<\/li>\n<\/ul>\n<p>4.0->4.1\uff08\u30de\u30a4\u30ca\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3067\u3059\u304c\uff09<\/p>\n<ul>\n<li>PROXY\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30b5\u30dd\u30fc\u30c8<\/li>\n<li>\u5185\u90e8\u51e6\u7406\u306b\u30d5\u30c3\u30af\u3067\u304d\u308b\u3088\u3046\u306a\u3057\u304f\u307f\u306e\u8ffd\u52a0<\/li>\n<\/ul>\n<p>4.1->5.0<\/p>\n<ul>\n<li>HTTP\/2\u306e\u5b9f\u9a13\u7684\u30b5\u30dd\u30fc\u30c8<\/li>\n<li>shard director(consistent-hash)\u5bfe\u5fdc<\/li>\n<li>\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u30d5\u30a7\u30c3\u30c1\u304cPROXY\u30d7\u30ed\u30c8\u30b3\u30eb\u30b5\u30dd\u30fc\u30c8<\/li>\n<li>\u5225VCL\u3092\u52d5\u7684\u30ea\u30f3\u30af\u3057\u3066\u4f7f\u3046label\u6a5f\u80fd\u306e\u30b5\u30dd\u30fc\u30c8<\/li>\n<\/ul>\n<p>\u3053\u3046\u3057\u3066\u307f\u308b\u30684.0\u306e\u9803\u304b\u3089HTTP\/2\u306e\u6e96\u5099\u3092\u7740\u5b9f\u306b\u3059\u3059\u3081\u3066\u3044\u305f\u306e\u304c\u308f\u304b\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u5b09\u3057\u3044\u3053\u3068\u306b5.0\u3067\u306f3.0->4.0\u306e\u3068\u304d\u306e\u3088\u3046\u306a\u7834\u58ca\u7684\u306aVCL\u306e\u5909\u66f4\u306f\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u3082\u3061\u308d\u3093\u5e7e\u3064\u304b\u306eVCL\u306e\u5909\u66f4\u306f\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3057\u304b\u3057\u5927\u62b5\u306e\u5834\u5408\u306f\u5909\u66f4\u305b\u305a\u3068\u3082\u52d5\u304d\u3001\u3082\u3057\u304f\u306f\u5c11\u3057\u306ereplace\u3067\u6e08\u3093\u3067\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001stats\u306e\u9805\u76ee\u3082\u524a\u3089\u308c\u305f\u3082\u306e\u306f\u3042\u308b\u3082\u306e\u306e\u51fa\u529b\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306f\u5909\u308f\u3063\u3066\u304a\u3089\u305a\u3001<br \/>\nLOG\u306b\u3064\u3044\u3066\u3082HTTP\/2\u95a2\u9023\u306e\u8ffd\u52a0\u306f\u3042\u308b\u3082\u306e\u306e\u5927\u304d\u306a\u5909\u66f4\u306f\u306a\u304f\u3001<br \/>\n\u5927\u62b5\u306eVMOD\u3082\u30ea\u30d3\u30eb\u30c9\u3059\u308c\u3070\u52d5\u304d\u3001\u7d2f\u7a4d\u30d0\u30b0\u306f\u4fee\u6b63\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u30014.1\u3067\u52d5\u3044\u3066\u3044\u305f\u76e3\u8996\u3084\u5468\u8fba\u30c4\u30fc\u30eb\u306f\u307b\u307c\u5909\u66f4\u306a\u3057\u3067\u52d5\u304d\u65e2\u5b58\u306e\u8cc7\u7523\u3092\u4f7f\u3044\u3084\u3059\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n10\/03\u6642\u70b9\u3067\u77e5\u308a\u5408\u3044\u306e\u30b5\u30a4\u30c8\u306e\u672c\u756a\u306b\u6295\u5165\u3057\u3066\u300120\u65e5\u7a0b\u5ea6\u7d4c\u904e\u3057\u3066\u3044\u307e\u3059\u304c\u5927\u304d\u306a\u554f\u984c\u3082\u306a\u304f\u52d5\u4f5c\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u5f53\u7136\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u306e\u305f\u3081\u614e\u91cd\u306a\u691c\u8a3c\u306f\u5fc5\u8981\u3067\u3059\u304c\u30013.0->4.0\u306e\u3068\u304d\u306e\u3088\u3046\u306a\u82e6\u3057\u307f\u306f\u306a\u304f<br \/>\nHTTP\/2\u3092\u4f7f\u308f\u306a\u3044\u306e\u3067\u3042\u308c\u3070\u3001\u3069\u3061\u3089\u304b\u3068\u8a00\u3046\u30684.0->4.1\u306e\u3068\u304d\u306e\u3088\u3046\u306a\u5909\u66f4\u3068\u601d\u3063\u3066\u3082\u3089\u3048\u308c\u3070\u3088\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3>\u65b0\u6a5f\u80fd<\/h3>\n<h4>HTTP\/2\u306e\u30b5\u30dd\u30fc\u30c8(experimental)<\/h4>\n<p>\u5148\u7a0b\u3082\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304cHTTP\/2\u306e\u6975\u3081\u3066\u5b9f\u9a13\u7684(Very Experimental)\u306a\u30b5\u30dd\u30fc\u30c8\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u6709\u52b9\u306b\u3059\u308b\u5834\u5408\u306f\u8d77\u52d5\u30d1\u30e9\u30e1\u30fc\u30bf\u3001\u3082\u3057\u304f\u306fvarnishadm\u3067feature\u30d1\u30e9\u30e1\u30fc\u30bf\u3092+http2\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u306a\u304a\u3001\u73fe\u6642\u70b9\u3067\u79c1\u304c\u78ba\u8a8d\u3057\u3066\u3044\u308b\u30d0\u30b0\u3060\u3068\u56de\u907f\u4e0d\u80fd\u3067\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u5bb9\u6613\u306b\u30af\u30e9\u30c3\u30b7\u30e5\u3092\u8d77\u3053\u3059\u3082\u306e\u304c1\u4ef6\u3001\u56de\u907f\u53ef\u80fd\u306a\u3082\u306e\u304c1\u4ef6\u3001\u4ed5\u69d8\u306a\u306e\u304b\u5224\u65ad\u3067\u304d\u306a\u3044\u304c\u5b9f\u88c5\u6f0f\u308c\u3063\u307d\u3044\u306e\u30921\u4ef6\u898b\u3064\u3051\u3066\u307e\u3059\u3002(\u307e\u305f\u4eca\u5ea6\u6ce3\u304d\u306a\u304c\u3089\u82f1\u8a9e\u66f8\u304d\u307e\u3059\uff09<br \/>\n\u305d\u306e\u305f\u3081\u6c7a\u3057\u3066\u672c\u756a\u306b\u6295\u5165\u3059\u308b\u3053\u3068\u306f\u304a\u3059\u3059\u3081\u3057\u307e\u305b\u3093\u3002<br \/>\n\u3057\u304b\u3057\u5b9f\u969b\u306b\u89e6\u3063\u3066\u307f\u3066\u3044\u308d\u3044\u308d\u30d0\u30b0\u3092\u898b\u3064\u3051\u3066\u5831\u544a\u3059\u308b\u3068\u3088\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u89e6\u3063\u3066\u307f\u3066\u307b\u3057\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<h4>vmod-director\u3067shared\u3092\u30b5\u30dd\u30fc\u30c8<\/h4>\n<p>consistent-hash\u306e\u30b5\u30dd\u30fc\u30c8\u3067\u3059\u3002<br \/>\n\u5143\u3005\u306fUPLEX\u304c\u63d0\u4f9b\u3057\u3066\u3044\u305f<a href=\"https:\/\/code.uplex.de\/uplex-varnish\/libvmod-vslp\">vslp<\/a>\u3092\u516c\u5f0f\u306b\u6301\u3063\u3066\u304d\u305f\u5f62\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nconsistent-hash\u306b\u3064\u3044\u3066\u306f\u3050\u3050\u308b\u3068\u3044\u308d\u3044\u308d\u51fa\u3066\u304f\u308b\u3068\u304a\u3082\u3046\u306e\u3067\u8a73\u3057\u304f\u306f\u5272\u611b\u3057\u307e\u3059\uff08<a href=\"http:\/\/www.slideshare.net\/paulowniaceae\/consistent-hash\">\u53c2\u8003<\/a>\uff09<br \/>\n\u4eca\u307e\u3067\u306fbackend\u6570\u306b\u5909\u52d5\u304c\u3042\u3063\u305f\u5834\u5408\u306b\u306f\u5168\u4f53\u3067\u518d\u8a08\u7b97\u304c\u8d70\u308b\u306e\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u30d2\u30c3\u30c8\u7387\u304c\u5168\u4f53\u3067\u843d\u3061\u308b\u554f\u984c\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u3053\u308c\u3092\u4f7f\u3046\u3053\u3068\u3067\u89e3\u6c7a\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br \/>\n\u7279\u306b\u8907\u6570\u53f0\u306e\u30af\u30e9\u30b9\u30bf\u3067\u8907\u6570\u6bb5\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u7d44\u3093\u3067\u308b\u74b0\u5883\u3067\u306f\u304b\u306a\u308a\u52b9\u3044\u3066\u304f\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><strong>VOID shard.set_rampup(DURATION duration=0)<\/strong><br \/>\n0\u79d2\u4ee5\u4e0a\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u3001\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u304chealthy\u306b\u306a\u3063\u305f\u5834\u5408\u306b\u3044\u304d\u306a\u308a100%\u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092\u6d41\u3059\u306e\u3067\u306f\u306a\u304f\u3001\u6307\u5b9a\u79d2\u6570(duration)\u306e\u9593\u306b\u5f90\u3005\u306b\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092\u6d41\u3057\u3066\u3044\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002(slow start)<\/p>\n<p><strong>BOOL shard.add_backend(BACKEND backend, STRING ident=0, DURATION rampup=973279260)<\/strong><br \/>\n\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<br \/>\nident\u306f\u30ce\u30fc\u30c9\u306e\u8b58\u5225\u5b50\u3067\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306e\u540d\u524d\u3092\u4f7f\u3046\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u901a\u5e38\u306f\u4f7f\u3046\u3053\u3068\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u304c\u3001weight\u7684\u306a\u6307\u5b9a\u3092\u3057\u305f\u3044\u3068\u304d\u306a\u3069\u306b\u4f7f\u3046\u3068\u826f\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u3067\u3059\u3002<br \/>\nrampup\u306f\u30b5\u30fc\u30d0\u500b\u5225\u306b\u6307\u5b9a\u3059\u308b\u5834\u5408\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002(973279260\u306fmagic value\u3067set_rampup\u3067\u6307\u5b9a\u3055\u308c\u305f\u5024\u3092\u4f7f\u3046\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff09<\/p>\n<p><strong>BOOL shard.remove_backend(BACKEND backend=0, STRING ident=0)<\/strong><br \/>\n\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u524a\u9664\u3057\u307e\u3059\u3002<br \/>\nbackend\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306f\u4e00\u81f4\u3059\u308b\u3059\u3079\u3066\u304c\u524a\u9664\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><strong>BOOL shard.clear(PRIV_TASK)<\/strong><br \/>\n\u5168\u3066\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<p><strong>VOID shard.set_warmup(REAL probability=0.0)<\/strong><br \/>\n\u6307\u5b9a\u306e\u78ba\u7387\u3067\u6b21\u306e\u4ee3\u66ff\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u3044\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002(0.5=50%)<\/p>\n<p><a href=\"http:\/\/blog.xcir.net\/wp-content\/uploads\/2016\/10\/warm.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.xcir.net\/wp-content\/uploads\/2016\/10\/warm-180x300.png\" alt=\"warm\" width=\"180\" height=\"300\" class=\"aligncenter size-medium wp-image-2353\" srcset=\"http:\/\/blog.xcir.net\/wp-content\/uploads\/2016\/10\/warm-180x300.png 180w, http:\/\/blog.xcir.net\/wp-content\/uploads\/2016\/10\/warm.png 376w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><\/p>\n<p>\u8981\u306f\u305d\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u304c\u6b7b\u3093\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u843d\u3061\u305f\u3068\u3057\u3066\u3082\u3001<br \/>\n\u4ee3\u66ff\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u304c\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u3042\u308b\u7a0b\u5ea6\u6301\u3063\u3066\u3044\u308b\u72b6\u614b\u306a\u306e\u3067\u30c0\u30a6\u30f3\u6642\u306e\u5f71\u97ff\u3092\u3088\u308a\u6e1b\u3089\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059<br \/>\n\uff08\u305f\u3060\u3057\u5f53\u7136\u306a\u304c\u3089\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u4e8c\u91cd\u6301\u3061\u304c\u8d77\u304d\u308b\u306e\u3067\u7a7a\u9593\u52b9\u7387\u306f\u60aa\u304f\u306a\u308a\u307e\u3059\uff09<br \/>\n\u306a\u304a\u3001rampup\u671f\u9593\u4e2d\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306fwarmup\u306e\u5bfe\u8c61\u5916\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>BOOL shard.reconfigure(INT replicas=67, ENUM {CRC32,SHA256,RS} alg=&#8221;SHA256&#8243;)<\/strong><br \/>\nconsistent-hash\u3067\u4f7f\u3046\u30cf\u30c3\u30b7\u30e5\u30ea\u30f3\u30b0\u3092\u4f5c\u308a\u307e\u3059\u3002<br \/>\nreplicas\u306f1\u3064\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u304c\u4eee\u60f3\u7684\u306b\u4f55\u500b\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306b\u306a\u308b\u304b\u3067\u3059\u3002\uff08consistent-hash\u306e\u4eee\u60f3\u30ce\u30fc\u30c9\uff09<br \/>\nalg\u306f\u3069\u306e\u30cf\u30c3\u30b7\u30e5\u95a2\u6570\u3092\u4f7f\u3063\u3066\u30cf\u30c3\u30b7\u30e5\u30ea\u30f3\u30b0\u306b\u914d\u7f6e\u3057\u3066\u3044\u304f\u304b\u3067\u3059\u3002<br \/>\n\u306a\u304a\u3001shard\u30c7\u30a3\u30ec\u30af\u30bf\u30fc\u3092\u4f7f\u3046\u5834\u5408\u306f\u5fc5\u305a\u4e00\u5ea6\u306f\u547c\u3073\u51fa\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u30a4\u30e1\u30fc\u30b8\u7684\u306b\u306fcommit\u3068\u601d\u3063\u3066\u3082\u3089\u3048\u308c\u3070\u826f\u3044\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><strong>BACKEND shard.backend(ENUM {HASH,URL,KEY,BLOB} by=&#8221;HASH&#8221;, INT key=0, BLOB key_blob=0, INT alt=0, REAL warmup=-1, BOOL rampup=1, ENUM {CHOSEN,IGNORE,ALL} healthy=&#8221;CHOSEN&#8221;)<\/strong><br \/>\n\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n<p><em>by=HASH(\u30c7\u30d5\u30a9\u30eb\u30c8)<\/em><br \/>\nvcl_hash\u3067\u751f\u6210\u3057\u305fhash\u5024\u3092\u4f7f\u7528\u3057\u3066\u632f\u308a\u5206\u3051\u30b5\u30fc\u30d0\u3092\u6c7a\u3081\u307e\u3059\u3002<\/p>\n<p><em>by=URL<\/em><br \/>\nreq.url\/bereq.url\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><em>by=KEY<\/em><br \/>\nkey\u3067\u6307\u5b9a\u3057\u305fINT\u6570\u5024\u3092\u4f7f\u3063\u3066\u632f\u308a\u5206\u3051\u3057\u307e\u3059\u3002<br \/>\n\u4f8b\u3048\u3070cookie\u3092\u3082\u3068\u306b\u632f\u308a\u5206\u3051\u3057\u305f\u3044\u5834\u5408\u306f<\/p>\n<pre class=\"brush: plain; \">\n\r\nshard.backend(by=KEY,key=shard.key(bereq.http.cookie))\r\n\n<\/pre>\n<p>\u3068\u3044\u3063\u305f\u611f\u3058\u3067\u3059\u3002<\/p>\n<p><em>by=BLOB<\/em><br \/>\nkey_blob\u6307\u5b9a\u3057\u305fblob\u3092\u4f7f\u3063\u3066\u632f\u308a\u5206\u3051\u3057\u307e\u3059\u3002<br \/>\n\u901a\u5e38\u306f\u4f7f\u3046\u3053\u3068\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001blob\u5168\u4f53\u3092\u4f7f\u3046\u306e\u3067\u306f\u306a\u304f\u5148\u982d4\u30d0\u30a4\u30c8\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><em>key<\/em><br \/>\nby=key\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306b\u6307\u5b9a\u3059\u308b\u6570\u5024\u3067\u3059<\/p>\n<p><em>key_blob<\/em><br \/>\nby=blob\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306b\u4f7f\u7528\u3059\u308bblob\u3067\u3059<\/p>\n<p><em>alt<\/em><br \/>\n\u6307\u5b9a\u3057\u305f\u5834\u5408\u306fn\u756a\u76ee\u306e\u4ee3\u66ff\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n\u3069\u306e\u3088\u3046\u306a\u3068\u304d\u306b\u4f7f\u3046\u304b\u3068\u3044\u3046\u3068\u4f55\u304b\u3057\u3089\u306e\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u3066\u5225\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u9078\u629e\u3057\u305f\u3044\u5834\u5408(restart\/retries\u6642\uff09\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<br \/>\nalt=req.restart or bereq.retries\u3068\u6307\u5b9a\u3057\u3066\u3044\u308b\u3068\u30ea\u30b9\u30bf\u30fc\u30c8\/\u30ea\u30c8\u30e9\u30a4\u306e\u305f\u3073\u306b\u5225\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br \/>\n\u306a\u304a\u3001rampup\/warmup\u306falt\u304c0\u306e\u3068\u304d\u306e\u307f\u6709\u52b9\u3067\u30011\u4ee5\u4e0a\u306e\u3068\u304d\u306falt\u304c\u512a\u5148\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><em>warmup<\/em><br \/>\n\u4ee3\u66ff\u30b5\u30fc\u30d0\u304c\u9078\u629e\u3055\u308c\u308b\u78ba\u7387\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002(-1,0~1)<br \/>\n-1\u306e\u5834\u5408\u306fset_warmup\u3067\u6307\u5b9a\u3057\u305f\u5024\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><em>rampup<\/em><br \/>\nrampup\u6a5f\u80fd\u3092\u4f7f\u3046\u304b\u3069\u3046\u304b\u3067\u3059\u3002<\/p>\n<p><em>healthy=CHOSEN(\u30c7\u30d5\u30a9\u30eb\u30c8)<\/em><br \/>\nhealthy\u306a\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\nalt\u304c0\u4ee5\u4e0a\u306e\u5834\u5408\u306f\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306ehealthy\u3092\u7121\u8996\u3057\u3066n\u756a\u76ee\u306e\u4ee3\u66ff\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306fthen return the next healthy backend.\u3068\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u30b3\u30fc\u30c9\u3068\u5b9f\u969b\u306e\u52d5\u4f5c\u3092\u898b\u308b\u9650\u308a\u3060\u3068alt\u6307\u5b9a\u6642\u306e\u4ee3\u66ff\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u9078\u629e\u3067\u306fhealthy\u304b\u306e\u8a55\u4fa1\u3092\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p><em>healthy=IGNORE<\/em><br \/>\nhelathy\u3092\u7121\u8996\u3057\u307e\u3059\u3002<br \/>\nalt\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306fhealthy\u3092\u7121\u8996\u3057\u305f\u72b6\u614b\u3067\u4ee3\u66ff\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n\u307e\u305frampup\/warmup\u306f\u6a5f\u80fd\u3057\u307e\u305b\u3093\u3002<\/p>\n<p>healthy=ALL<br \/>\n\u57fa\u672c\u7684\u306b\u306fCHOSEN\u3068\u540c\u3058\u3067\u3059\u304c\u3001alt\u304c0\u4ee5\u4e0a\u306e\u3068\u304d\u306b\u4ee3\u66ff\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u9078\u629e\u3059\u308b\u969b\u306b\u3082\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u3057\u307e\u3059\u3002<\/p>\n<p>\u3061\u3087\u3063\u3068\u3084\u3084\u3053\u3057\u3044\u306e\u3067\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f<\/p>\n<table border=1>\n<tr>\n<th>healthy<\/th>\n<th>alt==0<\/th>\n<th>alt&gt;0<\/th>\n<\/tr>\n<tr>\n<th>CHOSEN<\/th>\n<td>\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3046<\/td>\n<td>\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u884c\u308f\u306a\u3044<\/td>\n<\/tr>\n<tr>\n<th>IGNORE<\/th>\n<td>\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u884c\u308f\u306a\u3044<\/td>\n<td>\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u884c\u308f\u306a\u3044<\/td>\n<\/tr>\n<tr>\n<th>ALL<\/th>\n<td>\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3046<\/td>\n<td>\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3046<\/td>\n<\/tr>\n<\/table>\n<p>\u3000<\/p>\n<p><strong>INT shard.key(STRING string, ENUM {CRC32,SHA256,RS} alg=&#8221;SHA256&#8243;)<\/strong><br \/>\n\u6307\u5b9a\u3057\u305f\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u305f\u30cf\u30c3\u30b7\u30e5\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u901a\u3057\u305f\u3068\u304d\u306eINT\u5024\u3092\u5f97\u307e\u3059\u3002<br \/>\n\u4f8b\u3048\u3070SHA256\u306f256bit\u306a\u3093\u3067\u3059\u304c\u3001<a href=\"https:\/\/github.com\/varnishcache\/varnish-cache\/blob\/d0a81307fdeaef96625ff4cadc4b0cbc854e2252\/lib\/libvmod_directors\/shard_hash.c#L75-L79\">32bit\u5206<\/a>\u3060\u3051\u8fd4\u3057\u307e\u3059\u3002<br \/>\n\u3053\u306e\u95a2\u6570\u306fshard.backend\u3092by=KEY\u6307\u5b9a\u3067\u4f7f\u3046\u5834\u5408\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u3067\u3001\u5b9f\u969b\u306e\u3068\u3053\u308d\u3069\u3046\u3084\u3063\u3066\u4f7f\u3046\u304b\u3068\u3044\u3046\u3068\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; \">\n\r\n\r\nsub vcl_init {\r\n  new ws_cache = directors.shard();\r\n  ws_cache.set_rampup(10s);\r\n  ws_cache.add_backend(ws01);\r\n  ws_cache.add_backend(ws02);\r\n  ws_cache.add_backend(ws03);\r\n  ws_cache.add_backend(ws04);\r\n  ws_cache.reconfigure();\r\n}\r\n\r\nsub vcl_recv {\r\n  \/\/x-varnish-hash\u306b\u306f\u30e6\u30fc\u30b6ID\u3068\u304b\u305d\u3093\u306a\u306e\u304c\u5165\u3063\u3066\u308b\r\n  ...\r\n  set req.backend_hint = ws_cache.backend(by=KEY, key=ws_cache.key(req.url + &quot;:&quot; + req.http.host + &quot;:&quot; + req.http.x-varnish-hash));\r\n}\r\n\n<\/pre>\n<p>\u3000<\/p>\n<h4>INT,BACKEND\u578b\u304cBOOL\u3067\u8a55\u4fa1\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f<\/h4>\n<p>\u3053\u3046\u3044\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; \">\n\r\nsub vcl_recv {\r\n  if(1){\r\n    set resp.http.foo = &quot;1&quot;;\r\n  }\r\n  if(req.backend_hint){\r\n    set resp.http.bar = &quot;1&quot;;\r\n  }\r\n}\r\n\n<\/pre>\n<p>INT\u578b\u30670\u306ffalse\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001BACKEND\u578b\u3067\u306f\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306ffalse\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\u5225VCL\u3092\u52d5\u7684\u30ea\u30f3\u30af\u3057\u3066\u4f7f\u3046label\u6a5f\u80fd\u306e\u30b5\u30dd\u30fc\u30c8<\/h4>\n<p>\u3044\u307e\u307e\u3067\u7570\u306a\u308bVCL\u3092\u8aad\u307f\u8fbc\u3080\u65b9\u6cd5\u3068\u3057\u3066\u306finclude\u304c\u3042\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u306f\u5358\u7d14\u306binclude\u3092\u8a18\u8f09\u3057\u305f\u5834\u6240\u306b\u6307\u5b9a\u3057\u305fVCL\u3092\u5c55\u958b\u3059\u308b\u3082\u306e\u3067\u3057\u305f\u3002<br \/>\n\u305d\u3057\u3066\u4eca\u56de\u8ffd\u52a0\u3055\u308c\u305flabel\u306f\u5225\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u305fVCL\u3092\u52d5\u7684\u30ea\u30f3\u30af\u3057\u307e\u3059\u3002<br \/>\n\u3068\u308a\u3042\u3048\u305a\u4f7f\u3044\u65b9\u3092\u7d39\u4ecb\u3057\u307e\u3059<\/p>\n<p>\u307e\u305a\u30e9\u30d9\u30eb\u3092\u6301\u3064VCL\u3092load\u3057\u307e\u3059<\/p>\n<pre class=\"brush: shell; \">\n\r\nvarnishadm vcl.load a_example_net \/etc\/varnish\/a_examplet_net.vcl\r\nvarnishadm vcl.load b_example_net \/etc\/varnish\/b_examplet_net.vcl\r\nvarnishadm vcl.load c_example_net \/etc\/varnish\/c_examplet_net.vcl\r\n\r\nvarnishadm vcl.label vcl_a_example_net a_example_net\r\nvarnishadm vcl.label vcl_b_example_net b_example_net\r\nvarnishadm vcl.label vcl_c_example_net c_example_net\r\n\n<\/pre>\n<p>default.vcl<\/p>\n<pre class=\"brush: plain; \">\n\r\nvcl 4.0;\r\n\/\/\u6700\u4f4e\u96501\u3064\u306f\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u304c\u306a\u3044\u3068\u52d5\u304b\u306a\u3044\u306e\u3067\u30c0\u30df\u30fc\r\nbackend default { .host = &quot;127.0.0.1&quot;; }\r\n\r\nsub vcl_recv {\r\n  if(req.http.host ~ &quot;a\\.example\\.net$&quot;){\r\n    return(vcl(vcl_a_example_net));\r\n  }\r\n  if(req.http.host ~ &quot;b\\.example\\.net$&quot;){\r\n    return(vcl(vcl_b_example_net));\r\n  }\r\n  if(req.http.host ~ &quot;c\\.example\\.net$&quot;){\r\n    return(vcl(vcl_c_example_net));\r\n  }\r\n  return (synth(403));\r\n}\r\n\n<\/pre>\n<p>a.example.net\u306e\u5834\u5408\u306fvcl_a_example_net\u3068\u3044\u3046\u30e9\u30d9\u30eb\u3092\u6301\u3064VCL(\/etc\/varnish\/a_examplet_net.vcl)\u3092\u4f7f\u3046\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u4f55\u306b\u4f7f\u3048\u308b\u304b\u3068\u3044\u3046\u3068CDN\u306eMW\u3068\u3057\u3066Varnish\u3092\u4f7f\u3063\u3066\u3044\u305f\u308a\u3057\u3066\u5916\u90e8\u306e\u4eba\u306bVCL\u306e\u8a18\u8ff0\u3092\u89e3\u653e\u3057\u305f\u3044\u3051\u3069<br \/>\nVCL\u304c\u305d\u308c\u305e\u308c\u5e72\u6e09\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u305f\u3044\u5834\u5408\u306b\u4f7f\u3048\u307e\u3059\u3002<br \/>\nvcl_a_example_net\u306e\u4e2d\u304b\u3089b.examplet.net\u306b\u95a2\u3059\u308b\u51e6\u7406\u3092\u66f8\u3044\u3066\u3082\u305d\u3082\u305d\u3082\u305d\u3046\u3044\u3046\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u5272\u308a\u632f\u3089\u308c\u306a\u3044\u304b\u3089\u3067\u3059\u3002<br \/>\n\u307e\u305f\u3001\u4eca\u56de\u306freq.http.host\u3067\u5206\u3051\u307e\u3057\u305f\u304c\u3001\u3082\u3061\u308d\u3093\u4ed6\u306e\u30ad\u30fc\u3067\u632f\u308a\u5206\u3051\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u8a2d\u5b9a\u3092\u66f4\u65b0\u3059\u308b\u5834\u5408\u306f\u518d\u5ea6vcl.load\u3057\u3066vcl.label\u3092\u53e9\u304f\u611f\u3058\u3067\u3059<\/p>\n<pre class=\"brush: shell; \">\n\r\nvarnishadm vcl.load a_example_net_1 \/etc\/varnish\/a_examplet_net.vcl\r\nvarnishadm vcl.label vcl_a_example_net a_example_net_1\r\n\n<\/pre>\n<p>\u3061\u306a\u307f\u306bvcl.list\u3092\u898b\u3066\u307f\u308b\u3068\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308a\u307e\u3059<\/p>\n<pre class=\"brush: shell; \">\n\r\n# varnishadm vcl.list\r\nactive      auto\/warm          0 boot\r\navailable   auto\/warm          0 a_example_net\r\navailable  label\/warm          0 vcl_a_example_net -&gt; a_example_net_1\r\navailable   auto\/warm          6 a_example_net_1 (1 label)\r\n\n<\/pre>\n<p>vcl_a_example_net\u304ca_example_net_1\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u304c\u308f\u304b\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001reload\u3092\u884c\u3063\u305f\u5834\u5408\u306f\u30e9\u30d9\u30eb\u306e\u5148\u306eVCL\u306b\u3064\u3044\u3066\u306freload\u3055\u308c\u307e\u305b\u3093\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h4>\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u30d5\u30a7\u30c3\u30c1\u304cPROXY\u30d7\u30ed\u30c8\u30b3\u30eb\u30b5\u30dd\u30fc\u30c8<\/h4>\n<p>\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306e\u5b9a\u7fa9\u306b.proxy_header=[\u30d7\u30ed\u30c8\u30b3\u30eb\u30d0\u30fc\u30b8\u30e7\u30f3];\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067proxy\u30d7\u30ed\u30c8\u30b3\u30eb\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; \">\n\r\nbackend ws01 {.host = &quot;192.168.1.1&quot;;.proxy_header = 1;}\/\/PROXY\u30d7\u30ed\u30c8\u30b3\u30ebv1\r\nbackend ws02 {.host = &quot;192.168.1.2&quot;;.proxy_header = 2;}\/\/PROXY\u30d7\u30ed\u30c8\u30b3\u30ebv2\r\n\n<\/pre>\n<h4>varnishtest\u306e\u5f37\u5316\u30fb\u5909\u66f4<\/h4>\n<p>HTTP\/2\u306e\u30c6\u30b9\u30c8\u3084proxy\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30b5\u30dd\u30fc\u30c8\u304c\u884c\u308f\u308c\u307e\u3057\u305f\u3002<br \/>\n\u307e\u305f\u3001resp.msg\u306fresp.reason\u3078<br \/>\nsema\u306fbarrier\u306b\u540d\u524d\u304c\u5909\u66f4\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<h4>std.integer\u304cREAL\u578b\u306e\u6570\u5024\u3092\u30d1\u30fc\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f<\/h4>\n<p>1.2\u3068\u3044\u3063\u305f\u3082\u306e\u306f\u3082\u3061\u308d\u30931E+2\u307f\u305f\u3044\u306a\u8868\u8a18\u3082\u30d1\u30fc\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3082\u3061\u308d\u3093INT\u578b\u306b\u306a\u308b\u3088\u3046\u306b\u5c0f\u6570\u70b9\u4ee5\u4e0b\u306f\u524a\u9664\u3055\u308c\u307e\u3059\u3002<\/p>\n<h4>std.log\u304cvcl_init\u3067\u52d5\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f<\/h4>\n<p>\u3000<\/p>\n<h4>varnishhist\u306by\u8ef8\u306e\u76ee\u76db\u308a\u304c\u4ed8\u304d\u307e\u3057\u305f<\/h4>\n<p>\u3000<\/p>\n<h4>varnishstat\u306e-f\u30aa\u30d7\u30b7\u30e7\u30f3\u304cglob(7)\u306e\u5f62\u5f0f\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f<\/h4>\n<p>\u3000<\/p>\n<h4>POST\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f<\/h4>\n<p>\u6b63\u78ba\u306b\u306fVCL\u3092\u6b63\u3057\u304f\u66f8\u3051\u3070POST\u3082\u30ad\u30e3\u30c3\u30b7\u30e5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\uff08\u3082\u3061\u308d\u3093\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3055\u308c\u306a\u3044\u3067\u3059\uff09<br \/>\n\u5185\u90e8\u7684\u306a\u5909\u66f4\u3068\u3057\u3066body\u3092\u5e38\u306b\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306b\u9001\u308b\u3088\u3046\u306b\u5909\u66f4\u3055\u308c\u3066\u304a\u308a\u3001\u3053\u308c\u306b\u3088\u308aGET\u3068body\u3092\u4f7f\u3046POST\u306a\u3069\u3068\u6271\u3044\u304c\u5909\u308f\u3089\u306a\u304f\u306a\u3063\u305f\u305f\u3081\u3067\u3059\u3002<br \/>\n\u3068\u306f\u3044\u3048GET\u306fbody\u304c\u3044\u3089\u306a\u3044\u306e\u3067builtin.vcl\u3067\u306f\u524a\u9664\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; \">\n\r\nsub vcl_backend_fetch {\r\n    if (bereq.method == &quot;GET&quot;) {\r\n        unset bereq.body;\r\n    }\r\n    return (fetch);\r\n}\r\n\n<\/pre>\n<p>\u3082\u3057\u3001\u81ea\u8eab\u306eVCL\u304cbuiltin.vcl\u3092\u901a\u3089\u306a\u3044\uff08return)\u3057\u3066\u3044\u308b\u5834\u5408\u306funset bereq.body\u3092\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u3002<br \/>\n\u307e\u305f\u3001POST\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3068\u306f\u3044\u3048builtin.vcl\u3067\u306f\u3084\u306f\u308apass\u52d5\u4f5c\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8a66\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3053\u3053\u3092hash\u306b\u3059\u308c\u3070\u30ad\u30e3\u30c3\u30b7\u30e5\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\u3092\u4f5c\u308b\u969b\u306bbody\u3092\u8a55\u4fa1\u3057\u3066\u3044\u306a\u3044\u305f\u3081<br \/>\n\u3053\u3053\u3089\u3078\u3093\u306fbody\u306b\u5bfe\u3057\u3066\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308bvmod\u3092\u4f7f\u3063\u3066\u4e2d\u8eab\u3092\u7cbe\u67fb\u3057\u3066\u30cf\u30c3\u30b7\u30e5\u3092\u4f5c\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>\u4ed5\u69d8\u5909\u66f4<\/h3>\n<p><strong>stats\u304b\u3089n_waitinglist\u304c\u306a\u304f\u306a\u308a\u307e\u3057\u305f<\/strong><\/p>\n<p><strong>VCL\u540d\u306b\u6307\u5b9a\u53ef\u80fd\u306a\u6587\u5b57\u304c\u5236\u9650\u3055\u308c\u307e\u3057\u305f<\/strong><br \/>\n\u308f\u3056\u308f\u3056vcl\u540d\u3092\u4f7f\u3063\u3066\u3044\u308b\u4eba\u306f\u305d\u3093\u306a\u306b\u3044\u306a\u3044\u3068\u601d\u3046\u3093\u3067\u3059\u304c<br \/>\n[A-Za-z][A-Za-z0-9_-]*\u306b\u30de\u30c3\u30c1\u3059\u308b\u540d\u524d\u3058\u3083\u306a\u3044\u3068\u3060\u3081\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\u3059\u3079\u3066\u306eVCL\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u4f7f\u3046\u524d\u306b\u5b9a\u7fa9\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u304f\u306a\u308a\u307e\u3057\u305f<\/strong><br \/>\nbackend\u3068\u304bacl\u3068\u304b\u305d\u3046\u3044\u3046\u306e\u3067\u3059\u306d\u3001\u3080\u3057\u308d\u4eca\u307e\u3067\u610f\u8b58\u3057\u3066\u306a\u304b\u3063\u305f\uff08\u3044\u3064\u3082\u5148\u982d\u306b\u6301\u3063\u3066\u304d\u3066\u305f\uff09\u306e\u3067<br \/>\n\u3048\u3001\u3044\u3051\u305f\u306e\uff1f\u3050\u3089\u3044\u3067\u3059\u3002<\/p>\n<p><strong>pass(uncacheable)\u3055\u308c\u305f\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u306fcache-control\/Expires\u306eTTL\u306f\u30d1\u30fc\u30b9\u3055\u308c\u306a\u304f\u306a\u308a\u307e\u3057\u305f<\/strong><br \/>\n\u4eca\u307e\u3067\u306fpass\u3057\u305f\u5834\u5408\u3067\u3082TTL\u306e\u30d1\u30fc\u30b9\u306f\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3055\u308c\u306a\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u5bfe\u5fdc\u3059\u308b\u30ed\u30b0\u3082\u51fa\u529b\u3055\u308c\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><strong>-T\/-S\u3092\u7121\u52b9\u5316\u3059\u308b\u5834\u5408\u306f\u660e\u793a\u7684\u306bnone\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059<\/strong><\/p>\n<h3>\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5909\u66f4<\/h3>\n<p><strong>\u8ffd\u52a0\uff1aban_lurker_holdoff<\/strong><br \/>\n\u52b9\u7387\u7684\u3067\u306a\u3044ban\u306e\u6307\u5b9a\u306a\u3069\u3067ban.list\u304c\u80a5\u5927\u5316\u3057\u305f\u5834\u5408\u3001ban_lurker\u30b9\u30ec\u30c3\u30c9\u3068\u306e\u6f5c\u5728\u7684\u306a\u7af6\u5408\u306b\u3088\u308alookup\u6027\u80fd\u304c\u60aa\u5316\u3059\u308b\u30b1\u30fc\u30b9\u304c\u3042\u308a\u307e\u3057\u305f\u3002\u3053\u308c\u3092\u9632\u3050\u305f\u3081\u306bsleep\u3092\u5165\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u305d\u306e\u5024\u3067\u3059\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u306f0.1s\u3068ban_lurker_sleep\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n<p><strong>\u8ffd\u52a0\uff1asession_max<\/strong><br \/>\nsession_max\u306f\u524a\u9664\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u3082\u3068\u3082\u30684.0\u306e\u30ea\u30ea\u30fc\u30b9\u3067\u52b9\u679c\u304c\u306a\u304f\u306a\u3063\u305f\u3082\u306e\u3067\u3059\u3002<br \/>\n\u306a\u304a\u3001\u5c06\u6765\u7684\u306b\u5fa9\u6d3b\u3059\u308b\u53ef\u80fd\u6027\u306f\u3042\u308b\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p><strong>\u540d\u524d\u306e\u5909\u66f4\uff1avcl_dir->vcl_path \/ vmod_dir->vmod_path<\/strong><br \/>\n\u307e\u3060\u3069\u3061\u3089\u3082\u4f7f\u3048\u307e\u3059\u304c\u304a\u305d\u3089\u304f\u5c06\u6765\u7684\u306b_dir\u306e\u307b\u3046\u306f\u306a\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001:\u3067\u5206\u5272\u3057\u3066\u8907\u6570\u306epath\u3092\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\nvcl_path\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\/etc\/varnish:\/usr\/share\/varnish\/vcl\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u304c<br \/>\n\u3053\u308c\u306finclude\u306a\u3069\u3067VCL\u3092\u8aad\u3082\u3046\u3068\u3057\u305f\u969b\u306b\u307e\u305a\/etc\/varnish\u3092\u63a2\u7d22\u3057\u3001<br \/>\n\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f\/usr\/share\/varnish\/vcl\u3082\u63a2\u3059\u3068\u3044\u3063\u305f\u52d5\u304d\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\/usr\/share\/varnish\/vcl\u306b\u306f\u30c7\u30d0\u30a4\u30b9\u3092\u5224\u5b9a\u3059\u308b\u305f\u3081\u306edevicedetect.vcl\u304c\u5165\u3063\u3066\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>builtin.vcl\u306e\u5909\u66f4\u70b9<\/h3>\n<p><strong>GET\u6642\u306bbereq.body\u306eunset<\/strong><br \/>\n\u3053\u308c\u306f\u5148\u7a0b\u300cPOST\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u300d\u3067\u8aac\u660e\u3057\u305f\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<p><strong>hit-for-pass\u306e\u53d6\u6271\u306b\u3064\u3044\u3066<\/strong><br \/>\n\u4eca\u307e\u3067\u306freturn(pass)\u3057\u305f\u308a\u305d\u3082\u305d\u3082\u30ad\u30e3\u30c3\u30b7\u30e5\u3067\u304d\u306a\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306fhit-for-pass(HFP)\u3068\u3057\u3066\u30de\u30fc\u30af\u3055\u308c\u3066<br \/>\n2\u5206\u9593\u306f\u5e38\u306bpass\u6271\u3044\u3068\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u304c\u3001HFP\u3068\u3057\u3066\u30de\u30fc\u30af\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<br \/>\n\u4ee5\u4e0b\u304c4.1\u30685.0\u306ediff\u3067\u3059\u3002<\/p>\n<pre class=\"brush: diff; \">\n\r\n sub vcl_backend_response {\r\n-    if (beresp.ttl &lt;= 0s ||\r\n+    if (bereq.uncacheable) {\r\n+        return (deliver);\r\n+    } else if (beresp.ttl &lt;= 0s ||\r\n       beresp.http.Set-Cookie ||\r\n       beresp.http.Surrogate-control ~ &quot;no-store&quot; ||\r\n       (!beresp.http.Surrogate-Control &amp;&amp;\r\n         beresp.http.Cache-Control ~ &quot;no-cache|no-store|private&quot;) ||\r\n       beresp.http.Vary == &quot;*&quot;) {\r\n-        \/*\r\n-        * Mark as &quot;Hit-For-Pass&quot; for the next 2 minutes\r\n-        *\/\r\n+        # Mark as &quot;Hit-For-Pass&quot; for the next 2 minutes\r\n         set beresp.ttl = 120s;\r\n         set beresp.uncacheable = true;\r\n     }\r\n\n<\/pre>\n<h3>VCL\u306e\u5909\u66f4\u70b9<\/h3>\n<p><strong>backends\u306e\u5b9a\u7fa9\u306b.proxy_header\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f<\/strong><br \/>\n\u65b0\u6a5f\u80fd\u3067\u89e6\u308c\u305f\u3082\u306e\u3067\u3059<\/p>\n<p><strong>vcl_recv:return\u306bvcl(label)\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f<\/strong><br \/>\n\u65b0\u6a5f\u80fd\u3067\u89e6\u308c\u305f\u3082\u306e\u3067\u3059<\/p>\n<p><strong>vcl_recv:rollback\u304c\u524a\u9664\u3055\u308c\u307e\u3057\u305f<\/strong><\/p>\n<p><strong>vcl_hit:return(fetch)\u304c\u524a\u9664\u3055\u308c\u307e\u3057\u305f<\/strong><br \/>\n\u5143\u30054.1\u306e\u6642\u70b9\u3067fetch->miss\u306b\u5909\u66f4\u3059\u308b\u3088\u3046\u306b\u30a2\u30ca\u30a6\u30f3\u30b9\u304c\u51fa\u3066\u305f\u3082\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u524a\u9664\u3055\u3089\u3048\u307e\u3057\u305f\u3002<\/p>\n<p><strong>vcl_backend_*:remote.ip, client.ip, local.ip, server.ip\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f<\/strong><\/p>\n<p><strong>vcl_backend_fetch:bereq.body\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f<\/strong><br \/>\n\u65b0\u6a5f\u80fd\u3067\u89e6\u308c\u305f\u3082\u306e\u3067\u3059<\/p>\n<p><strong>vcl_backend_error:synthetic()\u304cberesp.body\u306b\u5909\u66f4\u3055\u308c\u307e\u3057\u305f<\/strong><br \/>\n\u3053\u3093\u306a\u611f\u3058\u306e\u8868\u8a18\u306b\u306a\u308a\u307e\u3059<\/p>\n<pre class=\"brush: plain; \">\n\r\n    set beresp.body = {&quot;&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n  &lt;head&gt;\r\n    &lt;title&gt;&quot;} + beresp.status + &quot; &quot; + beresp.reason + {&quot;&lt;\/title&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;\r\n    &lt;h1&gt;Error &quot;} + beresp.status + &quot; &quot; + beresp.reason + {&quot;&lt;\/h1&gt;\r\n    &lt;p&gt;&quot;} + beresp.reason + {&quot;&lt;\/p&gt;\r\n    &lt;h3&gt;Guru Meditation:&lt;\/h3&gt;\r\n    &lt;p&gt;XID: &quot;} + bereq.xid + {&quot;&lt;\/p&gt;\r\n    &lt;hr&gt;\r\n    &lt;p&gt;Varnish cache server&lt;\/p&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n&quot;};\r\n\n<\/pre>\n<p><strong>vcl_synth:synthetic()\u304cresp.body\u306b\u5909\u66f4\u3055\u308c\u307e\u3057\u305f<\/strong><\/p>\n<p><strong>vcl_deliver: obj.ttl, obj.age, obj.grace, obj.keep\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f(read)<\/strong><\/p>\n<p><strong>\u6b63\u898f\u8868\u73fe\u3067match\u3057\u305f\u6642\u306e\u7d50\u679c\u3092BOOL\u3068\u3057\u3066\u305d\u306e\u307e\u307e\u30bb\u30c3\u30c8\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f<\/strong><\/p>\n<pre class=\"brush: plain; \">\n\r\nset req.http.foo = req.http.bar ~ &quot;bar&quot;;\r\n\n<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306a\u8868\u8a18\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3>\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u6642\u306e\u6ce8\u610f<\/h3>\n<p><strong>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u69cb\u6210\u304c\u5909\u66f4\u3055\u308c\u305f<\/strong><br \/>\n\u5143\u3005\u306f<\/p>\n<ul>\n<li>Varnish\u672c\u4f53<\/li>\n<li>libs<\/li>\n<li>libs-dev<\/li>\n<li>docs<\/li>\n<\/ul>\n<p>\u306e4\u7a2e\u985e\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u5225\u308c\u3066\u3044\u305f\u306e\u3067\u3059\u304c<\/p>\n<ul>\n<li>Varnish\u672c\u4f53+lib+docs<\/li>\n<li>dev<\/li>\n<\/ul>\n<p>\u306e2\u7a2e\u985e\u306b\u5909\u66f4\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u305d\u306e\u305f\u3081\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u304d\u306b\u5931\u6557\u3059\u308b\u5834\u5408\u306f\u4e00\u5ea6\u65e2\u5b58\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>VMOD\u306eABI\u304c\u5909\u66f4\u3055\u308c\u305f\u306e\u3067\u30ea\u30d3\u30eb\u30c9\u304c\u5fc5\u8981<\/strong><br \/>\nVMOD\u306eABI\u304c\u5909\u66f4\u3055\u308c\u305f\u306e\u3067\u4f7f\u7528\u3057\u3066\u3044\u308bVMOD\u306b\u3064\u3044\u3066\u306f\u30ea\u30d3\u30eb\u30c9\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p><strong>\u74b0\u5883\u306b\u3088\u3063\u3066\u306freload\u306b\u5931\u6557\u3059\u308b\u304b\u3082<\/strong><br \/>\n\u3053\u308c\u306f\u79c1\u304c\u5f15\u3063\u639b\u304b\u3063\u305f\u554f\u984c\uff0b\u79c1\u306esystemd\u529b\u304c\u4f4e\u3044\u306e\u3067\u30d1\u30c3\u3068\u89e3\u6c7a\u7b56\u304c\u601d\u3044\u3064\u304b\u306a\u304b\u3063\u305f\u554f\u984c\u306a\u306e\u3067\u3059\u304c<br \/>\nVCL\u540d\u304c\u4ed5\u69d8\u5909\u66f4(\u5148\u982d\u6587\u5b57\u306f\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308b)\u3055\u308c\u305f\u3051\u3069\u3001reload\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u305d\u308c\u306b\u8ffd\u968f\u3057\u3066\u3044\u306a\u3044\u3088\u3046\u306b\u898b\u3048\u307e\u3059\u3002<br \/>\nXenial(systemd)\u3067\u30ea\u30ed\u30fc\u30c9\u3057\u3088\u3046\u3068\u3059\u308b\u3068<a href=\"https:\/\/github.com\/varnishcache\/pkg-varnish-cache\/blob\/7e8f0cc5b50100085b440505e033b66963b86b14\/debian\/reload-vcl#L45\">\u3053\u306e\u90e8\u5206<\/a>\u306eLOGNAME\u304c\u5165\u3089\u306a\u3044\u305f\u3081\u5148\u982d\u304cuuid\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nuuid\u306f\u6570\u5b57\u3092\u542b\u3080\u305f\u3081reload\u6642\u306bVCL\u540d\u306e\u4ed5\u69d8\u5909\u66f4\u306b\u5f15\u3063\u304b\u304b\u3063\u3066\u3057\u307e\u3046\u611f\u3058\u3067\u3059\u3002<br \/>\n\u3068\u308a\u3042\u3048\u305a\u5148\u982d\u306breload_\u3068\u304b\u3064\u3051\u3068\u3051\u3070\u56de\u907f\u306f\u3067\u304d\u308b\u306e\u3067\u3082\u3057\u5f15\u3063\u304b\u304b\u3063\u305f\u5834\u5408\u306f<\/p>\n<pre class=\"brush: diff; \">\n\r\n-    vcl_label=&quot;${LOGNAME}${LOGNAME:+_}${uuid}&quot;\r\n+    vcl_label=&quot;reload_${LOGNAME}${LOGNAME:+_}${uuid}&quot;\r\n\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u4fee\u6b63\u3059\u308b\u3068\u826f\u3044\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u79c1\u304cRHEL\/CentOS\u306e\u74b0\u5883\u3092\u6301\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u8a66\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u304a\u305d\u3089\u304fRHEL\u3067\u3082<a href=\"https:\/\/github.com\/varnishcache\/pkg-varnish-cache\/blob\/master\/redhat\/varnish_reload_vcl#L79\">\u540c\u69d8\u306e\u554f\u984c\u304c\u304a\u304d\u307e\u3059\u3002<\/a>(:\u306f\u4f7f\u3048\u306a\u3044)<\/p>\n<h3>\u305d\u306e\u4ed6\u5909\u66f4<\/h3>\n<p>\u7d2f\u7a4d\u30d0\u30b0\u304c\u76f4\u3063\u3066\u305f\u308a\u3001\u7d30\u304b\u3044\u6539\u5584\u304c\u3042\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<div class='wp_social_bookmarking_light'>        <div class=\"wsbl_hatena\"><a href='\/\/b.hatena.ne.jp\/add?mode=confirm&url=http%3A%2F%2Fblog.xcir.net%2F%3Fp%3D2332&title=Varnish5.0.0%E3%81%8C%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F' title='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='http:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/hatena.gif' alt='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' title='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' width='16' height='12' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_hatena_users\"><a href='\/\/b.hatena.ne.jp\/entry\/http:\/\/blog.xcir.net\/?p=2332' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish5.0.0\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='\/\/b.hatena.ne.jp\/entry\/image\/http:\/\/blog.xcir.net\/?p=2332' alt='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish5.0.0\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish5.0.0\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f'   class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_facebook\"><a href='http:\/\/www.facebook.com\/share.php?u=http%3A%2F%2Fblog.xcir.net%2F%3Fp%3D2332&t=Varnish5.0.0%E3%81%8C%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F' title='Facebook \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='http:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/facebook.png' alt='Facebook \u306b\u30b7\u30a7\u30a2' title='Facebook \u306b\u30b7\u30a7\u30a2' width='16' height='16' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_linkedin\"><a href='\/\/www.linkedin.com\/shareArticle?mini=true&url=http%3A%2F%2Fblog.xcir.net%2F%3Fp%3D2332&title=Varnish5.0.0%E3%81%8C%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F' title='LinkedIn \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='http:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/linkedin.png' alt='LinkedIn \u306b\u30b7\u30a7\u30a2' title='LinkedIn \u306b\u30b7\u30a7\u30a2' width='16' height='16' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"http:\/\/blog.xcir.net\/?p=2332\" data-text=\"Varnish5.0.0\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f\" data-lang=\"ja\">Tweet<\/a><\/div><\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u4e8c\u5e74\u3076\u308a\u3050\u3089\u3044\u306b\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u66f4\u65b0\u3055\u308c\u307e\u3057\u305f\u3002[\u516c\u5f0f\u30ea\u30ea\u30fc\u30b9]\u3000[\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9] \u4eca\u56de\u306e\u76ee\u7389\u6a5f\u80fd\u3068\u3057\u3066HTTP\/2\u5bfe\u5fdc\u3068Director\u306eConsistent Hash\u5bfe\u5fdc\u304c\u3042\u308a\u307e\u3059\u3002 \u306a\u306b\u306f\u3068\u3082\u3042\u308c\u3001\u3068\u308a\u3042\u3048\u305aH <a href='http:\/\/blog.xcir.net\/?p=2332' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[68,32],"class_list":["post-2332","post","type-post","status-publish","format-standard","hentry","category-3","tag-varnish5-0-0","tag-32","category-3-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/2332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2332"}],"version-history":[{"count":66,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/2332\/revisions"}],"predecessor-version":[{"id":2401,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/2332\/revisions\/2401"}],"wp:attachment":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2332"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}