{"id":684,"date":"2017-10-17T14:10:56","date_gmt":"2017-10-17T10:10:56","guid":{"rendered":"http:\/\/blog.5flor.ru\/?p=684"},"modified":"2017-11-22T17:55:24","modified_gmt":"2017-11-22T13:55:24","slug":"%d0%a3%d1%81%d1%82%d0%b0%d0%bd%d0%be%d0%b2%d0%ba%d0%b0-%d0%b8-%d0%bd%d0%b0%d1%81%d1%82%d1%80%d0%be%d0%b9%d0%ba%d0%b0-memcached-%d0%bd%d0%b0%d1%81%d1%82%d1%80%d0%be%d0%b9%d0%ba%d0%b0-%d0%b4%d0%bb","status":"publish","type":"post","link":"https:\/\/blog.5flor.ru\/?p=684","title":{"rendered":"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 memcached + \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 wordpress"},"content":{"rendered":"<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 memcached \u043d\u0430 Centos<\/p>\n<p>1.\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0435\u0432, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/p>\n<p>\u041b\u0438\u0431\u043e RPMForge<\/p>\n<p>i386<br \/>\nrpm -Uhv http:\/\/apt.sw.be\/redhat\/el5\/en\/i386\/rpmforge\/RPMS\/rpmforge-release-0.5.1-1.el5.rf.i386.rpm<br \/>\nx86_64<br \/>\nrpm -Uhv http:\/\/apt.sw.be\/redhat\/el5\/en\/x86_64\/rpmforge\/RPMS\/\/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm<br \/>\n\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043b\u044e\u0447\u0430<br \/>\nrpm \u2013import http:\/\/dag.wieers.com\/rpm\/packages\/RPM-GPG-KEY.dag.txt<\/p>\n<p>\u041b\u0438\u0431\u043e EPEL-<\/p>\n<p># rpm -Uvh http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/i386\/epel-release-5-4.noarch.rpm<\/p>\n<p># rpm -Uvh http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-5.rpm<\/p>\n<p>2.\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 memcached<\/p>\n<p>yum install memcached<\/p>\n<p>3.\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430,\u0437\u0430\u043f\u0443\u0441\u043a,\u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430<\/p>\n<p>nano \/etc\/sysconfig\/memcached<\/p>\n<p>PORT=\u00bb11211\u2033<\/p>\n<p>USER=\u00bbmemcached\u00bb<\/p>\n<p>MAXCONN=\u00bb1024\u2033 # \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439<\/p>\n<p>CACHESIZE=\u00bb64\u2033 # \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u043c\u044f\u0442\u0438,\u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0439 \u0434\u043b\u044f memcached<\/p>\n<p>OPTIONS=\u00bb-l 127.0.0.1\u2033 #\u0438\u043d\u0442\u0440\u0444\u0435\u0439\u0441,\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b(\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0442\u043e\u0438\u0442 \u0441\u0434\u0443\u0448\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 OPTIONS=\u00bb\u00bb<\/p>\n<p>\/etc\/init.d\/memcached start<\/p>\n<p>chkconfig \u2014level 2345 memcached on<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/p>\n<p>[root@guk5 ~]# netstat -nlp | grep memcached<\/p>\n<p>tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 3782\/memcached<\/p>\n<p>udp 0 0 127.0.0.1:11211 0.0.0.0:* 3782\/memcached<\/p>\n<p>[root@guk5 ~]# ps ax | grep memcached<\/p>\n<p>3782 ? Ssl 0:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P \/var\/run\/memcached\/memcached.pid -l 127.0.0.1<\/p>\n<p>3851 pts\/1 S+ 0:00 grep memcached<\/p>\n<p>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438<\/p>\n<p>memcached-tool 127.0.0.1 stats<\/p>\n<p>watch -d -n 1 \u00abecho \u00abstats\u00bb | nc localhost 11211\u2033<\/p>\n<p>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 Memcached<\/p>\n<p>memcached-tool 127.0.0.1 display<\/p>\n<p>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043a\u0435\u0448\u0430<\/p>\n<p>memcached-tool 127.0.0.1 dump | less<\/p>\n<p>2.\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Memcached \u0434\u043b\u044f PHP<\/p>\n<p>yum install php-pecl-memcache<\/p>\n<p>\u0440\u0435\u0441\u0442\u0430\u0440\u0442 apache<\/p>\n<p>\/etc\/init.d\/httpd restart<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438<\/p>\n<p>php -i |grep memcache<\/p>\n<p>memcache<\/p>\n<p>memcache support =&gt; enabled<\/p>\n<p>memcache.allow_failover =&gt; 1 =&gt; 1<\/p>\n<p>memcache.chunk_size =&gt; 32768 =&gt; 32768<\/p>\n<p>memcache.compress_threshold =&gt; 20000 =&gt; 20000<\/p>\n<p>memcache.default_port =&gt; 11211 =&gt; 11211<\/p>\n<p>memcache.hash_function =&gt; crc32 =&gt; crc32<\/p>\n<p>memcache.hash_strategy =&gt; consistent =&gt; consistent<\/p>\n<p>memcache.lock_timeout =&gt; 15 =&gt; 15<\/p>\n<p>memcache.max_failover_attempts =&gt; 20 =&gt; 20<\/p>\n<p>memcache.protocol =&gt; ascii =&gt; ascii<\/p>\n<p>memcache.redundancy =&gt; 1 =&gt; 1<\/p>\n<p>memcache.session_redundancy =&gt; 2 =&gt; 2<\/p>\n<p>Registered save handlers =&gt; files user memcache<\/p>\n<p>3.\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f php-\u0441\u0435\u0441\u0441\u0438\u0439 \u0432 memcached<\/p>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0430\u0439\u0442\u043e\u0432, \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/p>\n<p>nano \/etc\/php.ini<\/p>\n<p>;session.save_handler = files<\/p>\n<p>session.save_handler = memcache<\/p>\n<p>;session.save_path = \u00ab\/var\/lib\/php\/session\u00bb<\/p>\n<p>session.save_path = \u00ab127.0.0.1:11211\u00bb<\/p>\n<p>\/etc\/init.d\/httpd reload<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 Memcached \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<p>session.save_handler = memcache<\/p>\n<p>session.save_path = \u00abtcp:\/\/192.168.1.82:11211\u2033<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e Memcached \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u0441\u0441\u0438\u0439<\/p>\n<p>session.save_handler = memcache<\/p>\n<p>session.save_path=\u00bbtcp:\/\/ 192.168.1.82:11211, tcp:\/\/192.168.1.82:11211\u2033<\/p>\n<p>Memcached \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0441\u0441\u0438\u0439<\/p>\n<p>session.save_handler = memcache<\/p>\n<p>session.save_path=\u00bbtcp:\/\/127.0.0.1:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15\u00bb<\/p>\n<p>\u041a\u0430\u043a \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 php-\u0441\u0435\u0441\u0441\u0438\u0439 \u0432 memcached \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432<\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b .htaccess \u0432 \u043a\u043e\u0440\u043d\u0435 \u0441\u0430\u0439\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c<\/p>\n<p>php_value session.save_handler memcache<\/p>\n<p>php_value session.save_path 127.0.0.1:11211<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 memcached \u0432 wordpress.<\/p>\n<p>\u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, php \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u043e\u0431\u0440\u0430\u043d \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 memcached \u2013enable-memcache[=DIR].<\/p>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c memcached plugin for wordpress. \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432.<\/p>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c object-cache.php \u0438 memcached-client.php \u0432 \u043f\u0430\u043f\u043a\u0443 wp-content (\u043d\u0435 \u0432 \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432)<\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 memcached \u043f\u043e\u0447\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c $memcached_servers \u0432 wp-config.php. \u042d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0430\u0439\u043f\u0438:\u043f\u043e\u0440\u0442. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0438\u0442\u0441\u044f \u043d\u0430 11211 \u043f\u043e\u0440\u0442 \u043d\u0430 localhost.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 memcached:<\/p>\n<p>$memcached_servers = array(&#8216;192.168.1.1:11211&#8217;, &#8216;192.168.1.2:11211&#8217;);<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0430\u0439\u0442\u043e\u0432 wordpress \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 object-cache.php<br \/>\n\u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0443<br \/>\n$this-&gt;blog_prefix = ( is_multisite() ? $blog_id : $table_prefix ) . \u2018:\u2019;<br \/>\n\u043d\u0430<br \/>\n$this-&gt;blog_prefix = ( is_multisite() ? $blog_id : \u2018site.ru\u2019 ) . \u2018:\u2019;<\/p>\n<p>&nbsp;<\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043e \u0432\u0441\u0435\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 memcached \u043d\u0430 Centos 1.\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0435\u0432, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u041b\u0438\u0431\u043e RPMForge i386 rpm -Uhv http:\/\/apt.sw.be\/redhat\/el5\/en\/i386\/rpmforge\/RPMS\/rpmforge-release-0.5.1-1.el5.rf.i386.rpm x86_64 rpm -Uhv http:\/\/apt.sw.be\/redhat\/el5\/en\/x86_64\/rpmforge\/RPMS\/\/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043b\u044e\u0447\u0430 rpm \u2013import http:\/\/dag.wieers.com\/rpm\/packages\/RPM-GPG-KEY.dag.txt \u041b\u0438\u0431\u043e EPEL- # rpm -Uvh http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/i386\/epel-release-5-4.noarch.rpm # rpm -Uvh http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-5.rpm 2.\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 memcached &hellip; <a href=\"https:\/\/blog.5flor.ru\/?p=684\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,3,1],"tags":[],"class_list":["post-684","post","type-post","status-publish","format-standard","hentry","category-apache","category-linux","category-1"],"_links":{"self":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts\/684"}],"collection":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=684"}],"version-history":[{"count":0,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts\/684\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}