How to install & use memcached on CentOS
memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.
memcached allows you to take memory from parts of your system where you have more than you need and make it accessible to areas where you have less than you need.
memcached also allows you to make better use of your memory. If you consider the diagram to the right, you can see two deployment scenarios:
- Each node is completely independent (top).
- Each node can make use of memory from other nodes (bottom).
Install memcached on CentOS 6/7
yum install memcached
- Edit memcached file via the command
OPTIONS=”-l 127.0.0.1 -U 0″
- Restart memcached service
chkconfig memcached on
service memcached start
To use memcached on Php, you need to install some Php modules.
yum –enablerepo=remi,remi-php56 install php-pecl-memcached php-pecl-memcache
yum –enablerepo=remi,remi-php70 install php-pecl-memcached php-pecl-memcache
yum –enablerepo=remi,remi-php71 install php-pecl-memcached php-pecl-memcache
service php-fpm restart
service nginx restart