How to Install Memcached on CentOS
Memcached is a distributed, high-performance, in-memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read. Almost Every popular CMS has a plugin or module to take advantage of memcached. It in-memory and is thus quite speedy, since it does not need to write to disk. It is the only one caching system available freely and used by many big sites like YouTube, Facebook, Twitter, Reddit, Drupal, Zynga etc.
Follow these simple instructions:
- Step 1: Login into your WHM panel and using easyapache enable Memcache
- Step 2: SSH into your server and fire this command :
yum install memcached.x86_64 php-pecl-memcache.x86_64
- Step 3: Go toSoftware -> Module Installers -> PHP Pecl, Search for memcache and then install both memcache & memcached
- Step 4: Restart apache once by using this command :
service httpd restart
- Step 5: Start memcache by firing this command:
memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody(d = daemon, m = memory, u = user, l = IP to listen to, p = port)
- Step 6: Check your memcached server is running successfully by executing this command on terminal :
ps -eaf | grep memcached
You should now be able to use memcached within your application.