{"id":135,"date":"2010-04-28T19:33:21","date_gmt":"2010-04-28T10:33:21","guid":{"rendered":"http:\/\/blog.xcir.net\/?p=135"},"modified":"2010-04-28T19:33:21","modified_gmt":"2010-04-28T10:33:21","slug":"varnish%e3%82%92%e5%86%8d%e8%b5%b7%e5%8b%95%e7%84%a1%e3%81%97%e3%81%a7%e8%a8%ad%e5%ae%9a%e3%82%92%e9%81%a9%e7%94%a8%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95%e4%bf%ae%e6%ad%a3%e7%89%88","status":"publish","type":"post","link":"https:\/\/blog.xcir.net\/?p=135","title":{"rendered":"Varnish\u3092\u518d\u8d77\u52d5\u7121\u3057\u3067\u8a2d\u5b9a\u3092\u9069\u7528\u3059\u308b\u65b9\u6cd5(\u4fee\u6b63\u7248)"},"content":{"rendered":"<p><a href=\"\/index.php\/2010\/04\/varnish\u3067\u518d\u8d77\u52d5\u7121\u3057\u3067\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u9069\u7528\u3059\u308b\u65b9\u6cd5reload\/\">\u6628\u65e5\u30d7\u30ed\u30bb\u30b9\u3092\u5f37\u5f15\u306b\u3068\u308b\u624b\u6cd5<\/a>\u3067\u3084\u3063\u305f\u3068\u3053\u308d<br \/>\n\u3082\u3063\u3068\u3044\u3044\u65b9\u6cd5\u304c\u3042\u308b\u3088\u3068<a href=\"http:\/\/twitter.com\/mikeda\/status\/12955037985\" target=\"_blank\">@mikeda<\/a>\u3055\u3093\u304c\u6559\u3048\u3066\u304f\u308c\u307e\u3057\u305f\u306e\u3067\u4fee\u6b63\u3057\u307e\u3057\u305f<br \/>\n\u81ea\u524d\u3067\u4f5c\u308bRPM\u306evarnish\u306einit.d\u306f\u3053\u308c\u3067\u3044\u3053\u3046\u304b\u306a\u30fc\u3068<br \/>\n<!--more--><\/p>\n<h4>\/etc\/init.d\/varnish<\/h4>\n<pre class=\"brush: shell; \">\n\r\n#! \/bin\/sh\r\n#\r\n# varnish Control the varnish HTTP accelerator\r\n#\r\n# chkconfig: - 90 10\r\n# description: Varnish is a high-perfomance HTTP accelerator\r\n# processname: varnishd\r\n# config: \/etc\/sysconfig\/varnish\r\n# pidfile: \/var\/run\/varnish\/varnishd.pid\r\n\r\n### BEGIN INIT INFO\r\n# Provides: varnish\r\n# Required-Start: $network $local_fs $remote_fs\r\n# Required-Stop: $network $local_fs $remote_fs\r\n# Should-Start: $syslog\r\n# Short-Description: start and stop varnishd\r\n# Description: Varnish is a high-perfomance HTTP accelerator\r\n### END INIT INFO\r\n\r\n# Source function library.\r\n. \/etc\/init.d\/functions\r\n\r\nretval=0\r\npidfile=\/var\/run\/varnish.pid\r\n\r\nexec=&quot;\/usr\/sbin\/varnishd&quot;\r\nprog=&quot;varnishd&quot;\r\nconfig=&quot;\/etc\/sysconfig\/varnish&quot;\r\nlockfile=&quot;\/var\/lock\/subsys\/varnish&quot;\r\n# Include varnish defaults\r\n[ -e \/etc\/sysconfig\/varnish ] &amp;&amp; . \/etc\/sysconfig\/varnish\r\n################################\r\nPID=`cat \/var\/run\/varnish.pid`\r\nADM=`cat \/proc\/$PID\/cmdline|tr &#039;\\0&#039; &#039;!&#039;|sed -e &quot;s\/^.*-T\\!\\([^\\!]\\\\+\\)\\!.*$\/\\\\1\/g&quot;`\r\nNOW=`date +%s`\r\nif [ -z $VARNISH_VCL_CONF ]; then\r\n\tVARNISH_VCL_CONF=`cat \/proc\/$PID\/cmdline|tr &#039;\\0&#039; &#039;!&#039;|sed -e &quot;s\/^.*-f\\!\\([^\\!]\\\\+\\)\\!.*$\/\\\\1\/g&quot;`\r\nfi\r\n################################\r\n\r\nstart() {\r\n\r\n\tif [ ! -x $exec ]\r\n\tthen\r\n\t\techo $exec not found\r\n\t\texit 5\r\n\tfi\r\n\r\n\tif [ ! -f $config ]\r\n\tthen\r\n\t\techo $config not found\r\n\t\texit 6\r\n\tfi\r\n\techo -n &quot;Starting varnish HTTP accelerator: &quot;\r\n\r\n\t# Open files (usually 1024, which is way too small for varnish)\r\n\tulimit -n ${NFILES:-131072}\r\n\r\n\t# Varnish wants to lock shared memory log in memory.\r\n\tulimit -l ${MEMLOCK:-82000}\r\n\r\n\t# $DAEMON_OPTS is set in \/etc\/sysconfig\/varnish. At least, one\r\n\t# has to set up a backend, or \/tmp will be used, which is a bad idea.\r\n\tif [ &quot;$DAEMON_OPTS&quot; = &quot;&quot; ]; then\r\n\t\techo &quot;\\$DAEMON_OPTS empty.&quot;\r\n\t\techo -n &quot;Please put configuration options in $config&quot;\r\n\t\treturn 6\r\n\telse\r\n\t\t# Varnish always gives output on STDOUT\r\n\t\tdaemon   $exec -P $pidfile &quot;$DAEMON_OPTS&quot; &gt; \/dev\/null 2&gt;&amp;1\r\n\t\tretval=$?\r\n\t\tif [ $retval -eq 0 ]\r\n\t\tthen\r\n\t\t\ttouch $lockfile\r\n\t\t\techo_success\r\n\t\t\techo\r\n\t\telse\r\n\t\t\techo_failure\r\n\t\tfi\r\n\t\treturn $retval\r\n\tfi\r\n}\r\n\r\nstop() {\r\n\techo -n &quot;Stopping varnish HTTP accelerator: &quot;\r\n\tkillproc $prog\r\n\tretval=$?\r\n\techo\r\n\t[ $retval -eq 0 ] &amp;&amp; rm -f $lockfile\r\n\treturn $retval\r\n}\r\ngraceful() {\r\n\techo reload VCL file: $VARNISH_VCL_CONF\r\n\tvarnishadm -T $ADM vcl.load reload$NOW $VARNISH_VCL_CONF || error\r\n\tvarnishadm -T $ADM vcl.use reload$NOW || error\r\n\techo Current configs:\r\n\techo_success\r\n\techo\r\n\tvarnishadm -T $ADM vcl.list\r\n}\r\nerror(){\r\n\techo_failure\r\n\techo\r\n\texit 1\r\n}\r\nrestart() {\r\n\tstop\r\n\tstart\r\n}\r\n\r\nreload() {\r\n\tgraceful\r\n}\r\n\r\nforce_reload() {\r\n\trestart\r\n}\r\n\r\nrh_status() {\r\n\tstatus $prog\r\n}\r\n\r\nrh_status_q() {\r\n\trh_status &gt;\/dev\/null 2&gt;&amp;1\r\n}\r\n\r\n# See how we were called.\r\ncase &quot;$1&quot; in\r\n\tstart)\r\n\t\trh_status_q &amp;&amp; exit 0\r\n\t\t$1\r\n\t\t;;\r\n\tstop)\r\n\t\trh_status_q || exit 0\r\n\t\t$1\r\n\t\t;;\r\n\trestart)\r\n\t\t$1\r\n\t\t;;\r\n\tgraceful)\r\n\t\t$1\r\n\t\t;;\r\n\treload)\r\n\t\t$1\r\n\t\t;;\r\n\tforce-reload)\r\n\t\tforce_reload\r\n\t\t;;\r\n\tstatus)\r\n\t\trh_status\r\n\t\t;;\r\n\tcondrestart|try-restart)\r\n\t\trh_status_q || exit 0\r\n\t\trestart\r\n\t\t;;\r\n\t*)\r\n\techo &quot;Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|graceful|force-reload}&quot;\r\n\r\n\texit 2\r\nesac\r\n\r\nexit $?\r\n\n<\/pre>\n<p>sysconfig\u3067VCL\u30d5\u30a1\u30a4\u30eb\u306e\u5b9a\u7fa9\u304c\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u305d\u308c\u3092\u512a\u5148\u3057\u3066\u8aad\u307f\u8fbc\u3080\u3088\u3046\u306b\u4fee\u6b63\u3057\u307e\u3057\u305f(VARNISH_VCL_CONF)<br \/>\n\u307e\u305f\u30d7\u30ed\u30bb\u30b9\u306e\u5f15\u6570\u306fPID\u30d5\u30a1\u30a4\u30eb\u3067\u7279\u5b9a\u3057\u305f\u30d7\u30ed\u30bb\u30b9\u304b\u3089\u53d6\u5f97\u3059\u308b\u3053\u3068\u3067\u3088\u308a\u30b9\u30de\u30fc\u30c8\u306b\uff01<\/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%3D135&title=Varnish%E3%82%92%E5%86%8D%E8%B5%B7%E5%8B%95%E7%84%A1%E3%81%97%E3%81%A7%E8%A8%AD%E5%AE%9A%E3%82%92%E9%81%A9%E7%94%A8%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95%28%E4%BF%AE%E6%AD%A3%E7%89%88%29' 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=135' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish\u3092\u518d\u8d77\u52d5\u7121\u3057\u3067\u8a2d\u5b9a\u3092\u9069\u7528\u3059\u308b\u65b9\u6cd5(\u4fee\u6b63\u7248)' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='\/\/b.hatena.ne.jp\/entry\/image\/https:\/\/blog.xcir.net\/?p=135' alt='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish\u3092\u518d\u8d77\u52d5\u7121\u3057\u3067\u8a2d\u5b9a\u3092\u9069\u7528\u3059\u308b\u65b9\u6cd5(\u4fee\u6b63\u7248)' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - Varnish\u3092\u518d\u8d77\u52d5\u7121\u3057\u3067\u8a2d\u5b9a\u3092\u9069\u7528\u3059\u308b\u65b9\u6cd5(\u4fee\u6b63\u7248)'   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%3D135&t=Varnish%E3%82%92%E5%86%8D%E8%B5%B7%E5%8B%95%E7%84%A1%E3%81%97%E3%81%A7%E8%A8%AD%E5%AE%9A%E3%82%92%E9%81%A9%E7%94%A8%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95%28%E4%BF%AE%E6%AD%A3%E7%89%88%29' 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%3D135&title=Varnish%E3%82%92%E5%86%8D%E8%B5%B7%E5%8B%95%E7%84%A1%E3%81%97%E3%81%A7%E8%A8%AD%E5%AE%9A%E3%82%92%E9%81%A9%E7%94%A8%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95%28%E4%BF%AE%E6%AD%A3%E7%89%88%29' 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=135\" data-text=\"Varnish\u3092\u518d\u8d77\u52d5\u7121\u3057\u3067\u8a2d\u5b9a\u3092\u9069\u7528\u3059\u308b\u65b9\u6cd5(\u4fee\u6b63\u7248)\" data-lang=\"ja\">Tweet<\/a><\/div><\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u6628\u65e5\u30d7\u30ed\u30bb\u30b9\u3092\u5f37\u5f15\u306b\u3068\u308b\u624b\u6cd5\u3067\u3084\u3063\u305f\u3068\u3053\u308d \u3082\u3063\u3068\u3044\u3044\u65b9\u6cd5\u304c\u3042\u308b\u3088\u3068@mikeda\u3055\u3093\u304c\u6559\u3048\u3066\u304f\u308c\u307e\u3057\u305f\u306e\u3067\u4fee\u6b63\u3057\u307e\u3057\u305f \u81ea\u524d\u3067\u4f5c\u308bRPM\u306evarnish\u306einit.d\u306f\u3053\u308c\u3067\u3044\u3053\u3046\u304b\u306a\u30fc\u3068<\/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],"class_list":["post-135","post","type-post","status-publish","format-standard","hentry","category-3","tag-varnish","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\/135","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=135"}],"version-history":[{"count":3,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":138,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions\/138"}],"wp:attachment":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}