0

可以使用一些帮助。我有一个 drupal6 安装,我在为经过身份验证的用户缓存方面遇到了麻烦。Boost 很好地处理了未经身份验证的缓存。使用我当前的设置,根本无法创建会话,尝试登录时结果是“您无权查看此页面”。Memcache 和 apc 安装在服务器上,并根据 phpinfo 工作。这是我当前的设置(没有缓存路由器):

include_once('./sites/all/modules/memcache/memcache.inc');
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['session_inc'] =  './sites/all/modules/memcache/memcache-session.inc';
$conf['memcache_servers'] = array(
'127.0.0.1:11211' => 'default',
'127.0.0.1:11212' => 'block',
'127.0.0.1:11213' => 'content',
'127.0.0.1:11214' => 'filter',
'127.0.0.1:11215' => 'form',
'127.0.0.1:11216' => 'menu',
'127.0.0.1:11217' => 'page',
'127.0.0.1:11218' => 'update',
'127.0.0.1:11219' => 'views',
'127.0.0.1:11221' => 'session',
'127.0.0.1:11222' => 'users'
);

$conf['memcache_bins'] = array(
'cache' => 'default',
'cache_block' => 'block',
'cache_content' => 'content',
'cache_filter' => 'filter',
'cache_form' => 'form',
'cache_menu' => 'menu',
'cache_page' => 'page',
'cache_update' => 'update',
'cache_views' => 'views',
'session' => 'session',
'users' => 'users'
);

在此设置之前,我使用带有 authcache 的 cacherouter 并以 apc 作为引擎。用户可以登录,但对经过身份验证的用户没有实际的缓存。我一直在阅读我能找到的所有内容以使其继续进行,进行各种测试和更改配置,但没有成功。这是以前的设置:

$conf['cacherouter'] = array(
'default' => array(
'engine' => 'apc',
'server' => array('127.0.0.1:11211'),
'shared' => TRUE,
'prefix' => '',
'path' => 'storage_bin/filecache',
'static' => FALSE
),
);

$conf['cache_inc'] = './sites/all/modules/authcache/authcache.inc';

$conf['memcache_servers'] = array(
'127.0.0.1:11211' => 'default',
'127.0.0.1:11212' => 'block',
'127.0.0.1:11213' => 'content',
'127.0.0.1:11214' => 'filter',
'127.0.0.1:11215' => 'form',
'127.0.0.1:11216' => 'menu',
'127.0.0.1:11217' => 'page',
'127.0.0.1:11218' => 'update',
'127.0.0.1:11219' => 'views'
);

$conf['memcache_bins'] = array(
'cache' => 'default',
'cache_block' => 'block',
'cache_content' => 'content',
'cache_filter' => 'filter',
'cache_form' => 'form',
'cache_menu' => 'menu',
'cache_page' => 'page',
'cache_update' => 'update',
'cache_views' => 'views'
);

该网站在 www.thewildside.com 上可见。对此的任何帮助将不胜感激。

4

1 回答 1

1

如果其他人遇到这种情况,我的解决方案是放弃 cacherouter(没有按预期执行)、authcache(太 beta)和 boost(只是为了避免在缓存页面上完全访问 apache)……继续使用 Memcache API(drupal 模块)、memcache(缓存系统)、apc 和 varnish (3.0)。Memcache API 允许我通过 memcache 缓存到 RAM 和作为备份的 drupal db,以防 memcache 不可用(通过 memcache.db.inc)。基准测试以确定每个缓存组件使用多少 RAM。我也可以将会话信息保存在 memcache 中,但我没有注意到这样做有很大的性能提升,因此您可以选择不包含 memcache-session.inc。为每个 drupal 缓存数据库创建 memcache 实例(或使用一个默认实例)。为您创建的每个实例设置一个缓存箱,并输入反向代理设置和默认 ttl。

$conf = array(
'cache_inc'        => './sites/all/modules/memcache/memcache.db.inc',
'memcache_key_prefix' => 'ws',
'session_inc'      => './sites/all/modules/memcache/memcache-session.inc',
'memcache_servers' => array(
'unix:///var/run/memcached/memcached_wildside.sock' => 'default',
'unix:///var/run/memcached/memcached_wildside_apachesolr.sock' => 'apachesolr',
'unix:///var/run/memcached/memcached_wildside_block.sock' => 'block',
'unix:///var/run/memcached/memcached_wildside_content.sock' => 'content',
'unix:///var/run/memcached/memcached_wildside_filter.sock' => 'filter',
'unix:///var/run/memcached/memcached_wildside_form.sock' => 'form',
'unix:///var/run/memcached/memcached_wildside_media_youtube_status.sock' => 'media_youtube_status',
'unix:///var/run/memcached/memcached_wildside_menu.sock' => 'menu',
'unix:///var/run/memcached/memcached_wildside_objects.sock' => 'objects',
'unix:///var/run/memcached/memcached_wildside_page.sock' => 'page',
'unix:///var/run/memcached/memcached_wildside_path.sock' => 'path',
'unix:///var/run/memcached/memcached_wildside_rules.sock' => 'rules',
'unix:///var/run/memcached/memcached_wildside_update.sock' => 'update',
'unix:///var/run/memcached/memcached_wildside_views.sock' => 'views',
'unix:///var/run/memcached/memcached_wildside_views_data.sock' => 'views_data',
'unix:///var/run/memcached/memcached_wildside_session.sock' => 'session',
'unix:///var/run/memcached/memcached_wildside_users.sock' => 'users'),
'memcache_bins' => array(
'cache' => 'default',
'cache_apachesolr' => 'apachesolr',
'cache_block' => 'block',
'cache_content' => 'content',
'cache_filter' => 'filter',
'cache_form' => 'form',
'cache_media_youtube_status' => 'media_youtube_status',
'cache_menu' => 'menu',
'cache_objects' => 'objects',
'cache_page' => 'page',
'cache_path' => 'path',
'cache_rules' => 'rules',
'cache_update' => 'update',
'cache_views' => 'views',
'cache_views_data' => 'views_data',
'session' => 'session',
'users' => 'users'),
);

$conf['https'] = TRUE;
$conf['mimedetect_magic'] = '/usr/share/file/magic';
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array('127.0.0.1');

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])){
    if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
        $_SERVER['HTTPS']='on';
    }else{
        $_SERVER['HTTPS']='';
    }
}

/* 1 day cache lifetime = 86400 */
$conf['cache_lifetime'] = 86400;
$conf['page_cache_maximum_age'] = 86400;

设置 Varnish 的配置文件 (.vcl) 时,请确保您使用的语法与您安装的 varnish 版本相对应。

于 2012-10-15T17:20:53.260 回答