Appreciate, respect and accept it, don't take it for granted

Drupal 7 + Memcached on CentOS 6

2015-07-24
1
yum install memcached

設定Memcached

設定 /etc/sysconfig/memcached
注意OPTIONS=”-l 127.0.0.1”

Memcached PHP extension

安裝Memcached PHP extension

指定版本

1
sudo pecl install channel://pecl.php.net/memcache-3.0.6

設定Memcached PHP extension

設定/etc/php.d/memcache.ini

開啟hash相關設定

1
memcache.hash\_strategy=consistent

Drupal 7

安裝Drupal 7 memcache 模組

Memcache API and Integration

設定Drupal 7 setting.php

1
2
3
4
5
6
7
8
9
10
11
12
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
// The 'cache_form' bin must be assigned no non-volatile storage.
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['memcache_key_prefix'] = 'something_unique';
// Don't bootstrap the database when serving pages from the cache.
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;

$conf['memcache_stampede_protection'] = TRUE;
$conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';

注意事項

  1. 若memcache service有起來,Druapl卻沒連到,注意防火牆設定

Ref


Blog comments powered by Disqus