How to install and configure memcached on debian 8 linux (or similar like ubuntu ...) and setup with drupal 8 ?
Memcache is caching server allow you to incrise and have great performence on your site. Drupal and memcached work very well and here the full tutorial you need to install and setup memcache server and your drupal instance.
Install Mamcache
sudo apt-get install memcached
Start and get details
#Start
service memcached start
#Get details
#01
service memcached status
#02
ps -eaf | grep memcached
#03
netstat -tap | grep memcached
#04 : Get full details
echo "stats settings" | nc localhost 11211
Memcache configuration
Memcached configuration file is located on : /etc/memcached.conf
You can set the port, set memory size .... on this file.
Install PECL memcache packages
Chack :
php -m |grep mem
Install: (Not tested)
/usr/local/bin/pecl install memcache
Link : https://www.servint.net/university/article/the-tech-bench-how-to-install-php-memcache/
Setup Drupal tu use memcached instead of the database.
Edit the settings.php and add m configuration.
//Memcache configuration
$settings['memcache']['servers'] = ['127.0.0.1:11211' => 'default'];
$settings['memcache']['bins'] = ['default' => 'default'];
$settings['memcache']['key_prefix'] = '';
$settings['cache']['default'] = 'cache.backend.memcache';
How to check drupal using memcached not the database ?
1. TRUNCATE all tables start with cache_
2. Clear the cache using 'drush cr' or via interface.
-> If the tables start with cache_ does not contains any records, memcache is configured correctly. otherwise re check the configuration.
NOTE : Even correctly configured, Some times you can see 1 or two records in some tables. (memcache module is currently in development (Alpha version (2017/04/24)))
Comments2
Memcache on Drupal 8
Very good writeup. Also checkout how you can install memcache on your Drupal 8 site here.
In the present day, Memcache on Drupal 8 is an Alpha
In the present day, Memcache on Drupal 8 is an Alpha Version. There for it is not recommended to use in production sites.