Main menu

Install and configure memcached on CentOS7

What is Memcached ?

Memcached is an open source distributed object caching program. Which is widely used for dynamic web applications to store objects in memory. It can store the database tables, outputs, queries and code result-sets to import the web application performance.

Let Install and configure the Memcached in CentOS7 plateform..

Install the epel repository

# yum install epel-release

Update new repository and install memcached

# yum update && yum install memcached

Open the file called /etc/sysconfig/memcached with VI editor.

# vi /etc/sysconfig/memcached

PORT : Memcached will listen in this port
USER : Memcached run under this account.
MAXCONN : Maximum simultaneous connection memcached will listen.
CACHESIZE : Cache size how much data will be stored in memory.
OPTIONS : IP address of server so other application can connect to memcached daemon

Enable memcached daemon at startup

 # systemctl enable memcached

Start memcached daemon

# systemctl start memcached

Check memcached daemon status

#systemctl status memcached

Memcached-tool in installed with memache package, we can check the states on command line.

# memcached-tool stats

If applications or languages want to store objects in memcached,  first they need to communicate with memcached daemon. for this we need to install perticular extentions for them.

Install memcached daemon for PHP

# yum install php-pecl-memcache

Install Memcached Perl Library

# yum install perl-Cache-Memcached

Install Memcached Python Library

# yum install python-memcached

Restart the Apache service to reflect changes.

# systemctl restart httpd

For CMS like Drupal, WordPress and Joomla, you can get an Plugin to work with.