I have a cacherouter install that does something like this

$conf['cache_inc'] = './sites/all/modules/contrib/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'memcache',
    'server' => array('localhost:11211'),
    'shared' => TRUE,
    'static' => FALSE,
    'fast_cache' => TRUE,
  ),
  'cache_admin_menu' => array(
    'engine' => 'memcache',
    'server' => array('localhost:11212'),
  ),
  'cache_apachesolr' => array(
    'server' => array('localhost:11213'),
  ),
  'cache_block' => array(
    'server' => array('localhost:11214'),
  ),
...etc....
);

It works for the host 11211, but none of the others. Of course they are installed. I can check via SSH that these servers are running.

But non of them get any data through cacherouter. Also using cacherouter_stats, I see that only 11211 is detected for the stats. What could be the issue?

Comments

Anonymous’s picture

Despite my above settings, the $this->settings['servers'] in engines/memcache.php only shows Array ( [0] => localhost:11211 )

Anonymous’s picture

Ok I switched to devx version and changes "server" to "servers" -- it now works,

HOWEVER

cacherouter_stats doesnt show the correct servers, because it still looks for "server" instead of "servers" ...

Anonymous’s picture

--

tjmoyer’s picture

I'm having the same problem. It seems that only the default memcache bin is being recognized and used.

The info in the README file as well as what's listed on the project page indicate that there should be an array within the cacherouter array (settings.php) for each memcache bin. But only the default server info is getting through.

Here is my $conf array from settings.php:

$conf = array(

  'cache_inc' => './sites/all/modules/cacherouter/cacherouter.inc',

  'cacherouter' => array(
    'default' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11211'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'block' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11212'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'filter' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11213'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'form' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11214'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'page' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11215'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'menu' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11216'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'update' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11217'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'views' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11218'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'views_data' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11219'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'content' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11220'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

    'location' => array(
      'engine' => 'memcache',
      'server' =>  array('127.0.0.1:11221'),
      'shared' => TRUE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),
  ),
);

I have also tried:

$conf = array(
  'cacherouter' => array(
    'default' => array(
      'engine' => 'memcache',
      'server' =>  array(
        '127.0.0.1:11211'  => 'default' ,
        '127.0.0.1:11212'  => 'block' ,
        '127.0.0.1:11213'  => 'filter'  ,
        '127.0.0.1:11214'  => 'form'  ,
        '127.0.0.1:11215'  => 'page'  ,
        '127.0.0.1:11216'  => 'menu'  ,
        '127.0.0.1:11217'  => 'update'  ,
        '127.0.0.1:11218'  => 'views' ,
        '127.0.0.1:11219'  => 'views_data'  ,
        '127.0.0.1:11220'  => 'content' ,
        '127.0.0.1:11221'  => 'location'  ,
        '127.0.0.1:11222'  => 'pathdst' ,
        '127.0.0.1:11223'  => 'pathsrc' ,
      ),
      'shared' => TRUE,
      'prefix' => '',
//    'path' => 'sites/default/files/filecache',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),
  ),
);

With this second setting cache router statistics recognizes the bins, but not memcache.

I have tried changing 'server' to 'servers', but that makes drupal hang and cpu usage starts to spiral.

What am I doing wrong? Any ideas?

Thanks!

andypost’s picture

@tjmoyer 1) use servers
2) Don't use shared if using innstance per bin

    'views' => array(
      'engine' => 'memcache',
      'servers' =>  array('127.0.0.1:11218'),
      'shared' => FALSE,
      'prefix' => '',
      'static' => FALSE,
      'fast_cache' => TRUE,
    ),

Also see #245341: Unthrottled while loop in memcache engine causing high cpu utilization. and #588820: Creating severe load on system by logging thousands of unlink errors in DB log

tjmoyer’s picture

Ok, I changed the conf array to use 'servers' instead of 'server' and made 'shared' FALSE. But the options for each bin come through as an empty array (though default options come through ok).

If you print the $bin and $options out inside of function __construct within the memcache class in engines/memcache.php I get:

cache
Array
(
)
cache_pathsrc
Array
(
)
cache_pathdst
Array
(
)
cache_content
Array
(
)
cache_menu
Array
(
)
cache_filter
Array
(
)

While $default_options gives me:

Array
(
    [engine] => memcache
    [servers] => Array
        (
            [0] => 127.0.0.1:11211
        )

    [shared] => 
    [prefix] => 
    [static] => 
    [fast_cache] => 1
)

So it's still not recognizing any bins other than default.

andypost’s picture

use 'servers' not 'server' key to list memcache servers for bin

tjmoyer’s picture

As I mentioned in my previous post, I did change it from 'server' to 'servers' as you suggested, but it is still not recognizing and other bins other than default. At this point I have switched back to using the Memcache module, but would love to get this running and switch back over.

Any other ideas as to why it's not recognizing the other bins?