{"id":2632,"date":"2016-09-02T13:33:31","date_gmt":"2016-09-02T17:33:31","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2632"},"modified":"2017-04-19T15:57:04","modified_gmt":"2017-04-19T19:57:04","slug":"php-memcached-instances-centos-7","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/","title":{"rendered":"How to distribute PHP session on multiple memcached instances on CentOS 7"},"content":{"rendered":"<p>Memcached is, as the name alludes to, a memory caching system used by many high-traffic sites such as Twitter, Reddit and Facebook to cache data in order to speed up their web servers. Memcached is free and open source under the BSD license, so you can install it on your own web server. This guide walks you through the installation process for CentOS 7.<\/p>\n<h2>Getting started<\/h2>\n<p>For this guide, make sure you have the following:<br \/>\n\u2022 3 Nodes (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\">Cloud Server<\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\">Dedicated Server<\/a>) with a clean installation of CentOS 7.<br \/>\no 1 small server\/cloud instance for HAPROXY<br \/>\no 2 web servers\/cloud instances for Apache, PHP and Memcached<br \/>\n\u2022 All commands must be entered in root.<\/p>\n<p>Note: This guide will only show how to set up Memcached on three nodes. One node will be a proxy server, and then there will be two non-replicated apache web servers that each run an instance of Memcached. Each server will be able to access both Memcached instances.<\/p>\n<p>Additionally, to keep this article brief we will use a PHP script in place of a database. A production environment will always include databases.<\/p>\n<h2>Step-by-step guide<\/h2>\n<p>These are the IP addresses and server names that we&#8217;ll be referring to in this guide:<br \/>\n\u2022 LB1 173.209.44.219 10.0.0.93 Haproxy<br \/>\n\u2022 WEB1 173.209.44.220 10.0.0.94 Apache, PHP, Memcached<br \/>\n\u2022 WEB2 173.209.44.221 10.0.0.95 Apache, PHP, Memcached<\/p>\n<p>First, we&#8217;ll need to prepare all three servers. Make sure that each is up to date, that Selinux is disabled, and that their firewalls are disabled.<\/p>\n<p><code>yum -y update<\/code><\/p>\n<p><code>yum -y install nano wget<br \/>\nsetenforce 0<br \/>\nsed -i 's\/enabled\/disabled\/' \/etc\/sysconfig\/selinux<br \/>\nsystemctl disable firewalld<br \/>\nsystemctl stop firewalld<\/code><\/p>\n<p>We&#8217;ll focus LB1 first. The following basic configuration will suit most applications.<\/p>\n<p>Install the Haproxy package.<\/p>\n<p><code>yum -y install haproxy<\/code><\/p>\n<p>After it&#8217;s installed, open the configuration file.<\/p>\n<p><code>nano \/etc\/haproxy\/haproxy.cfg<\/code><\/p>\n<p>Replace its contents with the following:<\/p>\n<p><code class=\"gris\">global<br \/>\nlog 127.0.0.1 local2<br \/>\nchroot \/var\/lib\/haproxy<br \/>\npidfile \/var\/run\/haproxy.pid<br \/>\nmaxconn 4096<br \/>\nuser haproxy<br \/>\ngroup haproxy<br \/>\ndaemon<br \/>\nstats socket \/var\/run\/haproxy.cmd<br \/>\ndefaults<br \/>\nmode http<br \/>\nlog global<br \/>\noption httplog<br \/>\noption dontlognull<br \/>\noption httpclose<br \/>\noption forwardfor except 127.0.0.0\/8<br \/>\noption redispatch<br \/>\nretries 3<br \/>\ntimeout http-request 10s<br \/>\ntimeout queue 1m<br \/>\ntimeout connect 10s<br \/>\ntimeout client 45s<br \/>\ntimeout server 45s<br \/>\ntimeout check 10s<br \/>\nmaxconn 4096<br \/>\nlisten http :80<br \/>\nmode http<br \/>\nbalance roundrobin<br \/>\noption forwardfor<br \/>\noption httpclose<br \/>\noption http-server-close<br \/>\ntimeout http-keep-alive 3000<br \/>\nhttp-request del-header Proxy<br \/>\nserver web1 10.0.0.94:80 weight 1 check inter 3000 rise 2 fall 1<br \/>\nserver web2 10.0.0.95:80 weight 1 check inter 3000 rise 2 fall 1<\/code><\/p>\n<p>Now start Haproxy and enable it to run on boot.<\/p>\n<p><code>systemctl enable haproxy.service<br \/>\nsystemctl start haproxy.service<\/code><\/p>\n<p>Next, we&#8217;ll configure the two web servers. First, install the Apache, PHP and Memcached services. Be careful to install php-memecache, not php-memecached.<\/p>\n<p><code>yum -y install httpd php memcached libmemcached-devel php-pecl-memcache<\/code><\/p>\n<p>When that is completed, configure the Apache ServerName directive.<\/p>\n<p><code>nano \/etc\/httpd\/conf\/httpd.conf<\/code><\/p>\n<p>For identification purposes, set up a server name that corresponds to your site or infrastructure as follows:<\/p>\n<p><code>ServerName mysite.com<\/code><\/p>\n<p>Finally, verify that PHP was installed properly, and also that the memcache library is installed.<\/p>\n<p><code>[root@web1 ~]# php -m | grep memcache<br \/>\nmemcache<\/code><\/p>\n<p>Now it&#8217;s time to configure the PHP-memcache module for the distributed PHP sessions. Open the following file in an editor:<\/p>\n<p><code>nano \/etc\/php.d\/memcache.ini<\/code><\/p>\n<p>Replace the contents with:<\/p>\n<p><code class=\"gris\">extension=memcache.so<br \/>\nmemcache.maxreclevel=0<br \/>\nmemcache.maxfiles=0<br \/>\nmemcache.archivememlim=0<br \/>\nmemcache.maxfilesize=0<br \/>\nmemcache.maxratio=0<br \/>\nmemcache.hash_strategy = consistent<br \/>\nmemcache.allow_failover = 1<br \/>\nmemcache.session_redundancy = 3<\/code><\/p>\n<p>Bug alert: The memcache.session_redundancy value should be the sum of your configured memcached instances + 1. Since we are running 2 memcached servers, you must enter 3. This is a known bug in PHP.<\/p>\n<p>We&#8217;ll configure PHP to store user sessions in Memcached next. Open your php.ini file:<\/p>\n<p><code>nano \/etc\/php.ini<\/code><\/p>\n<p>Delete the line &#8220;session.save_handler = files&#8221; and insert the following lines in its place:<\/p>\n<p><code>session.save_handler = memcache<br \/>\nsession.save_path = \"tcp:\/\/10.0.0.94:11211, tcp:\/\/10.0.0.95:11211\"<\/code><\/p>\n<p>This next step is a little confusing, but bear with us. On CentOS 7 the RPM package also specifies the session save path in the Apache configuration. It can override our settings from php.ini, so we&#8217;ll have to erase it.<\/p>\n<p><code>nano \/etc\/httpd\/conf.d\/php.conf<\/code><\/p>\n<p>Delete these lines:<\/p>\n<p><code class=\"gris\">php_value session.save_handler \"files\"<br \/>\nphp_value session.save_path \"\/var\/lib\/php\/session\"<\/code><\/p>\n<p>Let&#8217;s configure Memcached to listen to each server&#8217;s local IP address. We can also configure Memcached&#8217;s memory usage at this point. We want each Memcached instance to accept 1024 connections and to have 256MB reserved for cache size. This will allow them to store many thousands of PHP sessions.<\/p>\n<p>Open this configuration file:<\/p>\n<p><code>nano \/etc\/sysconfig\/memcached<\/code><\/p>\n<p>Update the contents like so, making sure that the IP address is the same as what your server has:<\/p>\n<p><code class=\"gris\">PORT=\"11211\"<br \/>\nUSER=\"memcached\"<br \/>\nMAXCONN=\"1024\"<br \/>\nCACHESIZE=\"256\"<br \/>\nOPTIONS=\"-l 10.0.0.95\"<\/code><\/p>\n<p>Start both services and enable them on boot.<\/p>\n<p><code>systemctl start httpd<br \/>\nsystemctl start memcached<br \/>\nsystemctl enable httpd<br \/>\nsystemctl enable memcached<\/code><\/p>\n<p>Memcached is running, but is it working? We can test our configurations using a script. First, we&#8217;ll test the web servers and load balancing to make sure it&#8217;s creating sessions and that it&#8217;s balancing between the web servers.<\/p>\n<p>Create a new file named session.php inside \/var\/www\/html\/session.php with the following content:<\/p>\n<p><code>cd \/var\/www\/html<br \/>\nnano session.php<\/code><\/p>\n<p><code class=\"gris\">&lt;?php<br \/>\nheader('Content-Type: text\/plain');<br \/>\nsession_start();<br \/>\nif(!isset($_SESSION['visit']))<br \/>\n{<br \/>\necho \"Globo.Tech welcomes you as a first time visitor on this server\\n\";<br \/>\n$_SESSION['visit'] = 0;<br \/>\n}<br \/>\nelse<br \/>\necho \"This server has seen you \".$_SESSION['visit'] . \" times \\n\";<br \/>\n$_SESSION['visit']++;<br \/>\necho \"Server IP: \".$_SERVER['SERVER_ADDR'] . \"\\n\";<br \/>\necho \"Client IP: \".$_SERVER['REMOTE_ADDR'] . \"\\n\";<br \/>\nprint_r($_COOKIE);<br \/>\n?&gt;<\/code><\/p>\n<p>We&#8217;ll test PHP session creation and persistence next. By visiting the script we placed earlier via the load balancer IP, we&#8217;ll be able to verify that some visits will end up on the server WEB1 while others will end up on WEB2. Check that the session ID remains the same at each load. Also, the amount of visits should increase by one with every refresh.<\/p>\n<p>After visiting the script in your web browser, you can expect the following output:<\/p>\n<p><code class=\"gris\">This server has seen you 30 times<br \/>\nServer IP: 10.0.0.95<br \/>\nClient IP: 10.0.0.93<br \/>\nArray<br \/>\n(<br \/>\n[PHPSESSID] =&gt; aeoj7s47i7ke2l0fr7b534v684<br \/>\n)<\/code><\/p>\n<p>Upon refresh, you&#8217;ll end up on the other web server. The visit counter will become 31 while PHPSESSID remains the same.<\/p>\n<p><code class=\"gris\">This server has seen you 31 times<br \/>\nServer IP: 10.0.0.94<br \/>\nClient IP: 10.0.0.93<br \/>\nArray<br \/>\n(<br \/>\n[PHPSESSID] =&gt; aeoj7s47i7ke2l0fr7b534v684<br \/>\n)<\/code><\/p>\n<p>Try it out with another browser, too, to verify that this works over multiple sessions.<\/p>\n<p>If we install the utility netcat on LB1, we can query both memcached servers&#8217; stats to see if they&#8217;re working correctly and storing sessions.<br \/>\n<code>[root@lb1 ~] yum -y install nmap-ncat<\/code><\/p>\n<p>Use this command to see a server&#8217;s stats:<br \/>\n<code>[root@lb1 log] echo 'stats' | nc 10.0.0.94 11211<\/code><br \/>\n<code class=\"gris\">STAT pid 28882<br \/>\nSTAT uptime 39<br \/>\nSTAT time 1471052900<br \/>\nSTAT version 1.4.15<br \/>\nSTAT libevent 2.0.21-stable<br \/>\nSTAT pointer_size 64<br \/>\nSTAT rusage_user 0.016870<br \/>\nSTAT rusage_system 0.020244<br \/>\nSTAT curr_connections 5<br \/>\nSTAT total_connections 104<br \/>\nSTAT connection_structures 6<br \/>\nSTAT reserved_fds 20<br \/>\nSTAT cmd_get 1<br \/>\nSTAT cmd_set 195<br \/>\nSTAT cmd_flush 0<br \/>\nSTAT cmd_touch 0<br \/>\nSTAT get_hits 0<br \/>\nSTAT get_misses 1<br \/>\nSTAT delete_misses 0<br \/>\nSTAT delete_hits 0<br \/>\nSTAT incr_misses 1<br \/>\nSTAT incr_hits 0<br \/>\nSTAT decr_misses 0<br \/>\nSTAT decr_hits 0<br \/>\nSTAT cas_misses 0<br \/>\nSTAT cas_hits 0<br \/>\nSTAT cas_badval 0<br \/>\nSTAT touch_hits 0<br \/>\nSTAT touch_misses 0<br \/>\nSTAT auth_cmds 0<br \/>\nSTAT auth_errors 0<br \/>\nSTAT bytes_read 10212<br \/>\nSTAT bytes_written 2598<br \/>\nSTAT limit_maxbytes 268435456<br \/>\nSTAT accepting_conns 1<br \/>\nSTAT listen_disabled_num 0<br \/>\nSTAT threads 4<br \/>\nSTAT conn_yields 0<br \/>\nSTAT hash_power_level 16<br \/>\nSTAT hash_bytes 524288<br \/>\nSTAT hash_is_expanding 0<br \/>\nSTAT bytes 202<br \/>\nSTAT curr_items 2<br \/>\nSTAT total_items 195<br \/>\nSTAT expired_unfetched 0<br \/>\nSTAT evicted_unfetched 0<br \/>\nSTAT evictions 0<br \/>\nSTAT reclaimed 0<br \/>\nEND<\/code><\/p>\n<p>And then check the second one:<br \/>\n<code>[root@lb1 log] echo 'stats' | nc 10.0.0.95 11211<\/code><br \/>\n<code class=\"gris\">STAT pid 28117<br \/>\nSTAT uptime 50<br \/>\nSTAT time 1471052915<br \/>\nSTAT version 1.4.15<br \/>\nSTAT libevent 2.0.21-stable<br \/>\nSTAT pointer_size 64<br \/>\nSTAT rusage_user 0.013569<br \/>\nSTAT rusage_system 0.039201<br \/>\nSTAT curr_connections 5<br \/>\nSTAT total_connections 103<br \/>\nSTAT connection_structures 6<br \/>\nSTAT reserved_fds 20<br \/>\nSTAT cmd_get 97<br \/>\nSTAT cmd_set 291<br \/>\nSTAT cmd_flush 0<br \/>\nSTAT cmd_touch 0<br \/>\nSTAT get_hits 96<br \/>\nSTAT get_misses 1<br \/>\nSTAT delete_misses 0<br \/>\nSTAT delete_hits 0<br \/>\nSTAT incr_misses 1<br \/>\nSTAT incr_hits 96<br \/>\nSTAT decr_misses 0<br \/>\nSTAT decr_hits 0<br \/>\nSTAT cas_misses 0<br \/>\nSTAT cas_hits 0<br \/>\nSTAT cas_badval 0<br \/>\nSTAT touch_hits 0<br \/>\nSTAT touch_misses 0<br \/>\nSTAT auth_cmds 0<br \/>\nSTAT auth_errors 0<br \/>\nSTAT bytes_read 21822<br \/>\nSTAT bytes_written 8479<br \/>\nSTAT limit_maxbytes 268435456<br \/>\nSTAT accepting_conns 1<br \/>\nSTAT listen_disabled_num 0<br \/>\nSTAT threads 4<br \/>\nSTAT conn_yields 0<br \/>\nSTAT hash_power_level 16<br \/>\nSTAT hash_bytes 524288<br \/>\nSTAT hash_is_expanding 0<br \/>\nSTAT bytes 202<br \/>\nSTAT curr_items 2<br \/>\nSTAT total_items 291<br \/>\nSTAT expired_unfetched 0<br \/>\nSTAT evicted_unfetched 0<br \/>\nSTAT evictions 0<br \/>\nSTAT reclaimed 0<br \/>\nEND<\/code><\/p>\n<p>If you&#8217;re following the steps in this guide, you should see that both memcached servers have activity and content stored. Be warned, however, that this is not 100% bulletproof. If one of the two memcached instances ends suddenly, there is no guarantee that both servers contained the same exact sessions. However, the only consequence is that affected users will need to log back in.<\/p>\n<p>The final test for us is to test the failover and replication. Simply shut down either Memcached instance (but not both) and refresh our test script page.<\/p>\n<p><code>[root@web2 ~] systemctl stop memcached.service<\/code><\/p>\n<p>If the visit counter keeps going up after 2-3 refreshs, then failover is active and working.<\/p>\n<p>Let&#8217;s next confirm that replication is working. Start up the Memcached instance that you just shut down:<br \/>\n<code>[root@web2 ~] systemctl start memcached.service<\/code><\/p>\n<p>Now kill the Memcached instance on the other server.<br \/>\n<code>[root@web1 ~] systemctl stop memcached.service<\/code><\/p>\n<p>Re-visit the site. Again, you should see the counter increase every time you refresh. That means replication is also working.<\/p>\n<h2>Conclusion<\/h2>\n<p>Congratulations on completing the installation! Memcached is an excellent choice for a site that may scale. As your site grows, consider adding more Memcached servers for greater reliability and more caching power. If you found this tutorial useful, feel free to share it with others who may be interested. <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Memcached is, as the name alludes to, a memory caching system used by many high-traffic sites such as Twitter, Reddit and Facebook to cache data in order to speed up their web servers. Memcached is free and open source under the BSD license, so you can install it on your own web server. This guide<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[],"class_list":["post-2632","post","type-post","status-publish","format-standard","hentry","category-ha-clustering","operating_system-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to distribute PHP session on multiple memcached instances on CentOS 7 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to distribute PHP session on multiple memcached instances each running CentOS 7. Read now !\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to distribute PHP session on multiple memcached instances on CentOS 7 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to distribute PHP session on multiple memcached instances each running CentOS 7. Read now !\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-02T17:33:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-19T19:57:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/php-memcached-instances-centos-7\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/php-memcached-instances-centos-7\\\/\"},\"author\":{\"name\":\"GloboTech Communications\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"headline\":\"How to distribute PHP session on multiple memcached instances on CentOS 7\",\"datePublished\":\"2016-09-02T17:33:31+00:00\",\"dateModified\":\"2017-04-19T19:57:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/php-memcached-instances-centos-7\\\/\"},\"wordCount\":987,\"commentCount\":0,\"articleSection\":[\"HA &amp; Clustering\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/php-memcached-instances-centos-7\\\/\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/php-memcached-instances-centos-7\\\/\",\"name\":\"How to distribute PHP session on multiple memcached instances on CentOS 7 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\"},\"datePublished\":\"2016-09-02T17:33:31+00:00\",\"dateModified\":\"2017-04-19T19:57:04+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to distribute PHP session on multiple memcached instances each running CentOS 7. Read now !\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/php-memcached-instances-centos-7\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/php-memcached-instances-centos-7\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/php-memcached-instances-centos-7\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to distribute PHP session on multiple memcached instances on CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\\\/\\\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to distribute PHP session on multiple memcached instances on CentOS 7 - Globo.Tech","description":"This tutorial will show you how to distribute PHP session on multiple memcached instances each running CentOS 7. Read now !","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How to distribute PHP session on multiple memcached instances on CentOS 7 - Globo.Tech","og_description":"This tutorial will show you how to distribute PHP session on multiple memcached instances each running CentOS 7. Read now !","og_url":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/","og_site_name":"Globo.Tech","article_published_time":"2016-09-02T17:33:31+00:00","article_modified_time":"2017-04-19T19:57:04+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/#article","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/"},"author":{"name":"GloboTech Communications","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"headline":"How to distribute PHP session on multiple memcached instances on CentOS 7","datePublished":"2016-09-02T17:33:31+00:00","dateModified":"2017-04-19T19:57:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/"},"wordCount":987,"commentCount":0,"articleSection":["HA &amp; Clustering"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/","url":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/","name":"How to distribute PHP session on multiple memcached instances on CentOS 7 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-09-02T17:33:31+00:00","dateModified":"2017-04-19T19:57:04+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to distribute PHP session on multiple memcached instances each running CentOS 7. Read now !","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/php-memcached-instances-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to distribute PHP session on multiple memcached instances on CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2632"}],"version-history":[{"count":3,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2632\/revisions"}],"predecessor-version":[{"id":3066,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2632\/revisions\/3066"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}