\OC\Memcache\Redis not available for distributed cache (hub2roc)

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 22.1.0
Operating system and version: Debian 10.10 (buster)
nginx version: 1.14.2
PHP version: 7.4

The issue you are facing:

When i tried to configure memcache.distributed to Redis I get this error:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Is this the first time you’ve seen this error? : Y

Steps to replicate it:

  1. Add redis distributed configuration to config.php
  2. Load nextcloud

When the distributed redis is not in the config file the memcache.locking is working, so it seems that communication between nextcloud and redis localy is good.

The output of your Nextcloud log in Admin > Logging:

Nothing in the log

The output of your config.php file in /var/www/nextcloud



<?php
$CONFIG = array (
  'instanceid' => 'XXXXXX',
  'passwordsalt' => 'XXXXXXXX',
  'secret' => 'XXXXXXX',
  'trusted_domains' =>
  array (
    0 => 'mydomain.com',
    1 => '1.1.1.1',
  ),
  'datadirectory' => '/var/nc_data',
  'dbtype' => 'mysql',
  'version' => '22.1.0.1',
  'overwrite.cli.url' => 'https://mydomain.com',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'XXXXXXX',
  'installed' => true,
  'logfile' => '/var/nc_data/nextcloud.log',
  'loglevel' => 0,
  'logtimezone' => 'Europe/Paris',
  'log_rotate_size' => 104857600,
  'maintenance' => false,
  'mail_from_address' => 'cloud',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'mail.fr',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'mail.fr',
  'mail_smtpname' => 'test@mail.fr',
  'mail_smtppassword' => 'XXXXXX',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpport' => '465',
  'default_phone_region' => 'FR',
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
    'dbindex' => 0,
    'password' => 'XXXXXXX',
    'timeout' => 1.5,
  ),
);
?>

The output of your nginx log in /var/log/nginx/error.log:

mydomain.com, request: "GET /.well-known/webfinger HTTP/1.0", host: "mydomain.com"
2021/08/12 14:39:12 [error] 12471#12471: *149 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught OC\HintException: [0]: Memcache \OC\Memcache\Redis not available for distributed cache (Is the matching PHP module installed and enabled?)

  thrown in /var/www/nextcloud/lib/private/Memcache/Factory.php on line 94" while reading response header from upstream, client: 192.168.0.2, server: mydomain.com, request: "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.0", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "mydomain.com"

Have you checked,

  • that your Redis instance is up-and-running on your server?
  • that the web server user is allowed to access the given Redis socket?
  • that the used Redis password matches the one configured in the Redis configuration?

BTW, you are aware that a distributed cache is normally only required if you want to share a Redis cache between multiple servers?

Hi j-ed,

Thanks for your answer. It was a right issue for the web server.

Thanks a lot.

1 Like