{"id":64,"date":"2010-02-13T18:18:25","date_gmt":"2010-02-13T09:18:25","guid":{"rendered":"http:\/\/blog.xcir.net\/?p=64"},"modified":"2011-07-17T22:22:56","modified_gmt":"2011-07-17T13:22:56","slug":"varnish%e3%81%a7%e8%a4%87%e6%95%b0%e3%83%89%e3%83%a1%e3%82%a4%e3%83%b3%e7%ae%a1%e7%90%86%e3%81%a8%e3%83%98%e3%83%ab%e3%82%b9%e3%83%81%e3%82%a7%e3%83%83%e3%82%af%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/blog.xcir.net\/?p=64","title":{"rendered":"varnish\u3067\u8907\u6570\u30c9\u30e1\u30a4\u30f3\u7ba1\u7406\u3068\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>varnish\u306f\u30e1\u30e2\u30ea\u306e\u4f7f\u3044\u65b9\u3082\u3068\u3063\u3066\u3082\u7d20\u76f4\u3067\u30de\u30eb\u30c1\u30b3\u30a2\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u3066\u7d50\u69cb\u3044\u3044\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306a\u306e\u3067<br \/>\n\u4e00\u53f0\u3067\u8907\u6570\u306e\u30c9\u30e1\u30a4\u30f3\u3092\u7ba1\u7406\u3057\u3066\u3082\u554f\u984c\u306a\u3044\u3067\u3059<br \/>\n\u3058\u3083\u3041\u3069\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u4ee5\u4e0bVCL\u8a18\u8ff0\u4f8b<br \/>\n<!--more--><br \/>\n[code=&#8217;plain&#8217;]<br \/>\nsub vcl_recv {<br \/>\n    if (req.http.host ~ &#8220;^img01.xcir.net$&#8221;)<br \/>\n        #HTTP_HOST\u304cimg01.xcir.net\u306e\u5834\u5408cl_01\u3078\u51e6\u7406\u3092\u98db\u3070\u3059<br \/>\n        {set req.backend = cl_01;}<br \/>\n    elseif(req.http.host ~ &#8220;^img02.xcir.net$&#8221;)<br \/>\n        #HTTP_HOST\u304cimg02.xcir.net\u306e\u5834\u5408cl_02\u3078\u51e6\u7406\u3092\u98db\u3070\u3059<br \/>\n        {set req.backend = cl_02;}<br \/>\n}<br \/>\n##########################################################################################<br \/>\nbackend cache01_01 {<br \/>\n    .host = &#8220;192.168.1.111&#8221;;<br \/>\n    #\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u304d\u306fHOST\u3092\u8a2d\u5b9a\u3059\u308b<br \/>\n    .host_header = &#8220;img01.xcir.net&#8221;;<br \/>\n    .port = &#8220;80&#8221;;<br \/>\n    #\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u306e\u8a2d\u5b9a<br \/>\n    .probe = {<br \/>\n        .url = &#8220;\/healthcheck.gif&#8221;;<br \/>\n        .timeout = 0.3 s;<br \/>\n        .window = 8;<br \/>\n        .threshold = 3;<br \/>\n    }<br \/>\n}<br \/>\nbackend cache01_02 {<br \/>\n    .host = &#8220;192.168.1.112&#8221;;<br \/>\n    .host_header = &#8220;img01.xcir.net&#8221;;<br \/>\n    .port = &#8220;80&#8221;;<br \/>\n    .probe = {<br \/>\n        .url = &#8220;\/healthcheck.gif&#8221;;<br \/>\n        .timeout = 0.3 s;<br \/>\n        .window = 8;<br \/>\n        .threshold = 3;<br \/>\n    }<br \/>\n}<\/p>\n<p>director cl_01 random {<br \/>\n    .retries = 5;<br \/>\n    {<br \/>\n        .backend = cache01_01;<br \/>\n        .weight         = 5;<br \/>\n    }<br \/>\n    {<br \/>\n        .backend = cache01_02;<br \/>\n        .weight         = 5;<br \/>\n    }<br \/>\n}<br \/>\n##########################################################################################<br \/>\nbackend cache02_01 {<br \/>\n    .host = &#8220;192.168.1.121&#8221;;<br \/>\n    .host_header = &#8220;img02.xcir.net&#8221;;<br \/>\n    .port = &#8220;80&#8221;;<br \/>\n    .probe = {<br \/>\n        .url = &#8220;\/healthcheck.gif&#8221;;<br \/>\n        .timeout = 0.3 s;<br \/>\n        .window = 8;<br \/>\n        .threshold = 3;<br \/>\n    }<br \/>\n}<br \/>\nbackend cache02_02 {<br \/>\n    .host = &#8220;192.168.1.122&#8221;;<br \/>\n    .host_header = &#8220;img02.xcir.net&#8221;;<br \/>\n    .port = &#8220;80&#8221;;<br \/>\n    .probe = {<br \/>\n        .url = &#8220;\/healthcheck.gif&#8221;;<br \/>\n        .timeout = 0.3 s;<br \/>\n        .window = 8;<br \/>\n        .threshold = 3;<br \/>\n    }<br \/>\n}<br \/>\ndirector cl_02 random {<br \/>\n    .retries = 5;<br \/>\n    {<br \/>\n        .backend = cache02_01;<br \/>\n        .weight         = 5;<br \/>\n    }<br \/>\n    {<br \/>\n        .backend = cache02_02;<br \/>\n        .weight         = 5;<br \/>\n    }<br \/>\n}<br \/>\n##########################################################################################<br \/>\nsub vcl_fetch {<br \/>\n    if(obj.status==404){<br \/>\n        #404\u306e\u5834\u5408\u306fTTL\u3092\u4e00\u5206\u306b\u8a2d\u5b9a\u3059\u308b<br \/>\n        set obj.ttl=1m;<br \/>\n    }<br \/>\n}<br \/>\n[\/code]<br \/>\n.probe\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3068\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3044\u6307\u5b9aURL\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u306a\u3044\u5834\u5408<br \/>\n\u30ce\u30fc\u30c9\u5207\u308a\u96e2\u3057\u3092\u884c\u3044\u307e\u3059<br \/>\n\u5fa9\u5e30\u3059\u308c\u3070\u30ce\u30fc\u30c9\u306b\u8ffd\u52a0\u3057\u307e\u3059<\/p>\n<h3>\u3044\u304f\u3064\u304b\u306e\u30dd\u30a4\u30f3\u30c8\u306b\u3064\u3044\u3066<\/h3>\n<h4>.probe\u306e\u8a2d\u5b9a\u30dd\u30a4\u30f3\u30c8<\/h4>\n<p style=\"padding-left: 30px;\">.uri\u306f\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30afURL\u3067\u3059<br \/>\n\u753b\u50cf\u3067\u3082HTML\u3067\u3082\u306a\u3093\u3067\u3082\u3044\u3044\u3067\u3059\u304c\u3053\u308c\u304c\u306a\u3044\u3068\u30ce\u30fc\u30c9\u5207\u308a\u96e2\u3057\u3055\u308c\u307e\u3059\u306e\u3067\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046<\/p>\n<h4>vcl_fetch\u3067404\u3092\u898b\u3066\u3044\u308b\u7406\u7531<\/h4>\n<p style=\"padding-left: 30px;\">squid\u3067\u3044\u3046negative_ttl\u306e\u4ee3\u308f\u308a\u3067\u3059<br \/>\n\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u304c\u30c0\u30a6\u30f3\u3057\u3066\u305f\u3068\u304d\u306b\u5909\u306a\u60c5\u5831\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u3066\u3082\u3059\u3050\u5fa9\u5e30\u3067\u304d\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059<\/p>\n<p>\u672c\u5f53\u306f\u3044\u308d\u3044\u308d\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u3042\u3052\u308b\u30c6\u30af\u30cb\u30c3\u30af\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u307e\u305f\u306e\u6a5f\u4f1a\u306b\u30fb\u30fb\u30fb<\/p>\n","protected":false},"excerpt":{"rendered":"<p>varnish\u306f\u30e1\u30e2\u30ea\u306e\u4f7f\u3044\u65b9\u3082\u3068\u3063\u3066\u3082\u7d20\u76f4\u3067\u30de\u30eb\u30c1\u30b3\u30a2\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u3066\u7d50\u69cb\u3044\u3044\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306a\u306e\u3067 \u4e00\u53f0\u3067\u8907\u6570\u306e\u30c9\u30e1\u30a4\u30f3\u3092\u7ba1\u7406\u3057\u3066\u3082\u554f\u984c\u306a\u3044\u3067\u3059 \u3058\u3083\u3041\u3069\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u304b\uff1f \u4ee5\u4e0bVCL\u8a18\u8ff0\u4f8b<\/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":[5,13],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-3","tag-varnish","tag-varnish2-0-6","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\/64","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=64"}],"version-history":[{"count":9,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":492,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/64\/revisions\/492"}],"wp:attachment":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}