{"id":2056,"date":"2016-06-23T15:14:28","date_gmt":"2016-06-23T19:14:28","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2056"},"modified":"2017-11-24T18:11:43","modified_gmt":"2017-11-24T23:11:43","slug":"setup-memcache-centos-7","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/","title":{"rendered":"How to Setup Memcache on CentOS 7"},"content":{"rendered":"<h1>How to Setup Memcache on CentOS 7<\/h1>\n<p>Memcache is a key piece of infrastructure for many applications. Databases, queues and remote services are often the bottleneck in web requests, but in many instances the information they contain does not change. Memcache is a standard daemon that can cache arbitrary values, and can speed up everything from MySQL queries to REST requests.<\/p>\n<h2>Getting Started with Memcache<\/h2>\n<p>To complete this guide, you will need the following:<br \/>\n\u2022 1 Node (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\"><b>Cloud Server<\/b><\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\"><b>Dedicated Server<\/b><\/a>) with CentOS 7 and a LAMP stack previously installed<\/p>\n<p>When we&#8217;re finished, your LAMP stack will be augmented with Memcache, and you can begin integrating it into existing sites and apps.<\/p>\n<h2>Tutorial<\/h2>\n<p>To start, we&#8217;ll install the memcached package.<\/p>\n<p><code>yum -y install memcached<\/code><\/p>\n<p>The package is now installed, but it must also be started. We must also configure it to run on boot so it launches when your server comes up.<\/p>\n<p><code>systemctl start memcached.service<br \/>\nsystemctl enable memcached.service<\/code><\/p>\n<p>Now memcached must be configured for optimal use. We&#8217;ll take care of that here.<\/p>\n<p><code>nano \/etc\/sysconfig\/memcached<\/code><\/p>\n<p>You&#8217;ll want to allocate some memory to memcached. This is achieved by changing the CACHESIZE value, setting it to the desired amount of RAM allocated to the cache.<\/p>\n<p><code class=\"gris\">PORT=\"11211\"<br \/>\nUSER=\"memcached\"<br \/>\nMAXCONN=\"1024\"<br \/>\nCACHESIZE=\"64\"<br \/>\nOPTIONS=\"\"<\/code><\/p>\n<p>Since you&#8217;ve just changed the configuration, you&#8217;ll need to restart memcached so the new values take effect.<\/p>\n<p><code>systemctl restart memcached.service<\/code><\/p>\n<p>To use memcached from PHP, an extension is required. We&#8217;ll install that next.<\/p>\n<p><code>yum -y install php-pecl-memcache<\/code><\/p>\n<p>Now that PHP has been updated, you&#8217;ll need to restart Apache so it has access to the newly-installed module. Also, restart memcached for good measure.<\/p>\n<p><code>systemctl restart httpd.service<br \/>\nsystemctl restart memcached.service<\/code><\/p>\n<p>Let&#8217;s confirm that the memcached module is loaded so you can begin using it in scripts.<\/p>\n<p><code>php -m | grep memcache<br \/>\nmemcache<\/code><\/p>\n<p>To further check the status of the module, we&#8217;ll create a PHP info page. This function returns your PHP environment configuration information. If memcached is correctly configured, this will include details of the memcached support.<\/p>\n<p><code>nano \/var\/www\/html\/index.php<\/code><\/p>\n<p><code>&lt;?php<br \/>\nphpinfo();<br \/>\n?&gt;<\/code><\/p>\n<p>We&#8217;ll finally check the status of the memcached module in PHP. Do his by visiting the page you just created at http:\/\/your_main_ip\/index.php<\/p>\n<h2>Conclusion<\/h2>\n<p>Memcache is now installed, configured and included in your LAMP stack. You can now speed up your PHP applications by incorporating fast, efficient, RAM-based caches into slow portions of your scripts. If this guide was helpful to you, kindly share it with others who may also 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>How to Setup Memcache on CentOS 7 Memcache is a key piece of infrastructure for many applications. Databases, queues and remote services are often the bottleneck in web requests, but in many instances the information they contain does not change. Memcache is a standard daemon that can cache arbitrary values, and can speed up everything<!-- 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":[61,70],"tags":[],"class_list":["post-2056","post","type-post","status-publish","format-standard","hentry","category-database","category-web-hosting","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 Setup Memcache on CentOS 7 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will walk you through the setup of Memcache on your CentOS 7 Server. Read now and speed up everything from MySQL queries to REST requests!\" \/>\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\/setup-memcache-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 Setup Memcache on CentOS 7 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will walk you through the setup of Memcache on your CentOS 7 Server. Read now and speed up everything from MySQL queries to REST requests!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-23T19:14:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-24T23:11:43+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=\"2 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\\\/setup-memcache-centos-7\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/setup-memcache-centos-7\\\/\"},\"author\":{\"name\":\"GloboTech Communications\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"headline\":\"How to Setup Memcache on CentOS 7\",\"datePublished\":\"2016-06-23T19:14:28+00:00\",\"dateModified\":\"2017-11-24T23:11:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/setup-memcache-centos-7\\\/\"},\"wordCount\":386,\"commentCount\":0,\"articleSection\":[\"Database\",\"Web Hosting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/setup-memcache-centos-7\\\/\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/setup-memcache-centos-7\\\/\",\"name\":\"How to Setup Memcache on CentOS 7 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\"},\"datePublished\":\"2016-06-23T19:14:28+00:00\",\"dateModified\":\"2017-11-24T23:11:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will walk you through the setup of Memcache on your CentOS 7 Server. Read now and speed up everything from MySQL queries to REST requests!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/setup-memcache-centos-7\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/setup-memcache-centos-7\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/setup-memcache-centos-7\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Setup Memcache 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 Setup Memcache on CentOS 7 - Globo.Tech","description":"This tutorial will walk you through the setup of Memcache on your CentOS 7 Server. Read now and speed up everything from MySQL queries to REST requests!","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\/setup-memcache-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How to Setup Memcache on CentOS 7 - Globo.Tech","og_description":"This tutorial will walk you through the setup of Memcache on your CentOS 7 Server. Read now and speed up everything from MySQL queries to REST requests!","og_url":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/","og_site_name":"Globo.Tech","article_published_time":"2016-06-23T19:14:28+00:00","article_modified_time":"2017-11-24T23:11:43+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":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/#article","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/"},"author":{"name":"GloboTech Communications","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"headline":"How to Setup Memcache on CentOS 7","datePublished":"2016-06-23T19:14:28+00:00","dateModified":"2017-11-24T23:11:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/"},"wordCount":386,"commentCount":0,"articleSection":["Database","Web Hosting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/","url":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/","name":"How to Setup Memcache on CentOS 7 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-06-23T19:14:28+00:00","dateModified":"2017-11-24T23:11:43+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will walk you through the setup of Memcache on your CentOS 7 Server. Read now and speed up everything from MySQL queries to REST requests!","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/setup-memcache-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Setup Memcache 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\/2056","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=2056"}],"version-history":[{"count":6,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2056\/revisions"}],"predecessor-version":[{"id":3908,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2056\/revisions\/3908"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}