I have set up an account with Redis Labs and created a Memcachd server. To authenticate, I need to use a SASL username and password.
I got errors both in the install file - the requirements were not met; and when trying to access the cache bins.
The .install file
I needed to add support for the sasl_auth user ID and the sasl_auth password. As SASL authentication only works with the binary protocol enabled, I had to set that option.
DrupalMemcached.php
This file already provided support for the sasl_auth user ID and sasl_auth password - but did not enforce the required binary protocol.
DrupalMemcachedBase.php
I needed to add support for the sasl_auth user ID and the sasl_auth password. As SASL authentication only works with the binary protocol enabled, I had to set that option.
DrupalMemcachedDebug.php
Here I fixed an unrelated bug that overwrote the value of a variable with a string - but then tried to re-use the original value of that variable.
Results
I am now getting cache hits and results
ACTION TOTAL TIME, MS TOTAL HITS / % TOTAL MISSES / % get 458.12 40 / 97.6% 1 / 2.4% getMulti 9.48 9 / 100.0% 0 / 0.0%
settings.php
// Sets default cache storage as Memcache and excludes database connection for cache $settings['cache']['default'] = 'cache.backend.memcache_storage'; // Sets Memcache key prefix for your site and useful in working sites with same memcache as backend. $settings['memcache_storage']['key_prefix'] = ''; // Sets Memcache storage servers. $settings['memcache_storage']['memcached_servers'] = ['memcached-hostname.example.com:12345' => 'default']; // Memcache settings $settings['cache']['bins']['bootstrap'] = 'cache.backend.memcache_storage'; $settings['cache']['bins']['discovery'] = 'cache.backend.memcache_storage'; $settings['cache']['bins']['config'] = 'cache.backend.memcache_storage'; // Enables to display total hits and misses $settings['memcache_storage']['debug'] = TRUE; $settings['memcache_storage']['sasl_auth'] = [ 'user' => '** username **', 'password' => '** password **', ]; // When using SASL, Memcached extension needs to be used // because Memcache extension doesn't support it. $settings['memcache_storage']['extension'] = 'Memcached'; $settings['memcache_storage']['memcached_options'] = [ \Memcached::OPT_BINARY_PROTOCOL => TRUE, \Memcached::OPT_TCP_NODELAY => TRUE, \Memcached::OPT_COMPRESSION => FALSE, \Memcached::OPT_DISTRIBUTION => \Memcached::DISTRIBUTION_CONSISTENT, ];
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | memcache_storage-3028644.patch | 3.49 KB | paddy_deburca |
Comments
Comment #2
paddy_deburca commentedComment #3
paddy_deburca commentedFor some extra information, in my settings.php file I have the following entries
Comment #4
paddy_deburca commented