{"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":"https:\/\/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--><\/p>\n<pre class=\"brush: plain; \">\n\r\nsub vcl_recv {\r\n    if (req.http.host ~ &quot;^img01.xcir.net$&quot;)\r\n        #HTTP_HOST\u304cimg01.xcir.net\u306e\u5834\u5408cl_01\u3078\u51e6\u7406\u3092\u98db\u3070\u3059\r\n        {set req.backend = cl_01;}\r\n    elseif(req.http.host ~ &quot;^img02.xcir.net$&quot;)\r\n        #HTTP_HOST\u304cimg02.xcir.net\u306e\u5834\u5408cl_02\u3078\u51e6\u7406\u3092\u98db\u3070\u3059\r\n        {set req.backend = cl_02;}\r\n}\r\n##########################################################################################\r\nbackend cache01_01 {\r\n    .host = &quot;192.168.1.111&quot;;\r\n    #\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u304d\u306fHOST\u3092\u8a2d\u5b9a\u3059\u308b\r\n    .host_header = &quot;img01.xcir.net&quot;;\r\n    .port = &quot;80&quot;;\r\n    #\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u306e\u8a2d\u5b9a\r\n    .probe = {\r\n        .url = &quot;\/healthcheck.gif&quot;;\r\n        .timeout = 0.3 s;\r\n        .window = 8;\r\n        .threshold = 3;\r\n    }\r\n}\r\nbackend cache01_02 {\r\n    .host = &quot;192.168.1.112&quot;;\r\n    .host_header = &quot;img01.xcir.net&quot;;\r\n    .port = &quot;80&quot;;\r\n    .probe = {\r\n        .url = &quot;\/healthcheck.gif&quot;;\r\n        .timeout = 0.3 s;\r\n        .window = 8;\r\n        .threshold = 3;\r\n    }\r\n}\r\n\r\ndirector cl_01 random {\r\n    .retries = 5;\r\n    {\r\n        .backend = cache01_01;\r\n        .weight         = 5;\r\n    }\r\n    {\r\n        .backend = cache01_02;\r\n        .weight         = 5;\r\n    }\r\n}\r\n##########################################################################################\r\nbackend cache02_01 {\r\n    .host = &quot;192.168.1.121&quot;;\r\n    .host_header = &quot;img02.xcir.net&quot;;\r\n    .port = &quot;80&quot;;\r\n    .probe = {\r\n        .url = &quot;\/healthcheck.gif&quot;;\r\n        .timeout = 0.3 s;\r\n        .window = 8;\r\n        .threshold = 3;\r\n    }\r\n}\r\nbackend cache02_02 {\r\n    .host = &quot;192.168.1.122&quot;;\r\n    .host_header = &quot;img02.xcir.net&quot;;\r\n    .port = &quot;80&quot;;\r\n    .probe = {\r\n        .url = &quot;\/healthcheck.gif&quot;;\r\n        .timeout = 0.3 s;\r\n        .window = 8;\r\n        .threshold = 3;\r\n    }\r\n}\r\ndirector cl_02 random {\r\n    .retries = 5;\r\n    {\r\n        .backend = cache02_01;\r\n        .weight         = 5;\r\n    }\r\n    {\r\n        .backend = cache02_02;\r\n        .weight         = 5;\r\n    }\r\n}\r\n##########################################################################################\r\nsub vcl_fetch {\r\n    if(obj.status==404){\r\n        #404\u306e\u5834\u5408\u306fTTL\u3092\u4e00\u5206\u306b\u8a2d\u5b9a\u3059\u308b\r\n        set obj.ttl=1m;\r\n    }\r\n}\r\n\n<\/pre>\n<p>.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<div class='wp_social_bookmarking_light'>        <div class=\"wsbl_hatena\"><a href='\/\/b.hatena.ne.jp\/add?mode=confirm&url=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D64&title=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' 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='https:\/\/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\/https:\/\/blog.xcir.net\/?p=64' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - varnish\u3067\u8907\u6570\u30c9\u30e1\u30a4\u30f3\u7ba1\u7406\u3068\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3059\u308b\u65b9\u6cd5' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='\/\/b.hatena.ne.jp\/entry\/image\/https:\/\/blog.xcir.net\/?p=64' alt='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - varnish\u3067\u8907\u6570\u30c9\u30e1\u30a4\u30f3\u7ba1\u7406\u3068\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3059\u308b\u65b9\u6cd5' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - varnish\u3067\u8907\u6570\u30c9\u30e1\u30a4\u30f3\u7ba1\u7406\u3068\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3059\u308b\u65b9\u6cd5'   class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_facebook\"><a href='http:\/\/www.facebook.com\/share.php?u=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D64&t=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' title='Facebook \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='https:\/\/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=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D64&title=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' title='LinkedIn \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='https:\/\/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=\"https:\/\/blog.xcir.net\/?p=64\" data-text=\"varnish\u3067\u8907\u6570\u30c9\u30e1\u30a4\u30f3\u7ba1\u7406\u3068\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3059\u308b\u65b9\u6cd5\" data-lang=\"ja\">Tweet<\/a><\/div><\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\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":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=64"}],"version-history":[{"count":9,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":492,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/64\/revisions\/492"}],"wp:attachment":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}