Nextcloud stop working with redis

My installation of nextcloud was working well, I did update my archlinux server as usually. There was nothing what could change nextcloud, but I did reboot server because of new kernel. After boot I am getting this message when browsing my nextcloud:

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.

and this is just first two lines from nextcloud.log after I did hit my local nextcloud url

{"reqId":"6IOIAlNzzIYOvziGMllP","level":3,"time":"2019-07-16T19:58:26+00:00","remoteAddr":"192.168.10.117","user":"--","app":"PHP","method":"GET","url":"\/ocs\/v2.php\/apps\/notifications\/api\/v2\/notifications","message":"OC\\HintException: Memcache \\OC\\Memcache\\Redis not available for distributed cache at \/usr\/share\/webapps\/nextcloud\/lib\/private\/Memcache\/Factory.php#114","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:68.0) Gecko\/20100101 Firefox\/68.0","version":"16.0.3.0"}
{"reqId":"EQRcOPemNIzMNC9vNyqt","level":3,"time":"2019-07-16T19:58:28+00:00","remoteAddr":"192.168.10.117","user":"--","app":"index","method":"GET","url":"\/index.php","message":{"Exception":"OC\\HintException","Message":"Memcache \\OC\\Memcache\\Redis not available for distributed cache","Code":0,"Trace":[{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/Server.php","line":510,"function":"__construct","class":"OC\\Memcache\\Factory","type":"->","args":["64786a8b1b4f5dca05e41ed46a0e705c",{"__class__":"OC\\Log"},"\\OC\\Memcache\\APCu","\\OC\\Memcache\\Redis","\\OC\\Memcache\\Redis"]},{"file":"\/usr\/share\/webapps\/nextcloud\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":165,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"\/usr\/share\/webapps\/nextcloud\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":114,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["MemCacheFactory"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/Server.php","line":1541,"function":"query","class":"OC\\ServerContainer","type":"->","args":["MemCacheFactory"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/Server.php","line":697,"function":"getMemCacheFactory","class":"OC\\Server","type":"->","args":[]},{"file":"\/usr\/share\/webapps\/nextcloud\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OC\\App\\AppManager"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":165,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\App\\AppManager"]},{"file":"\/usr\/share\/webapps\/nextcloud\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":114,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["AppManager"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/Server.php","line":1731,"function":"query","class":"OC\\ServerContainer","type":"->","args":["AppManager"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/legacy\/app.php","line":343,"function":"getAppManager","class":"OC\\Server","type":"->","args":[]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/legacy\/app.php","line":114,"function":"getEnabledApps","class":"OC_App","type":"::","args":[]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/base.php","line":640,"function":"loadApps","class":"OC_App","type":"::","args":[["session"]]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/base.php","line":1056,"function":"init","class":"OC","type":"::","args":[]},{"file":"\/usr\/share\/webapps\/nextcloud\/index.php","line":40,"args":["\/usr\/share\/webapps\/nextcloud\/lib\/base.php"],"function":"require_once"}],"File":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/Memcache\/Factory.php","Line":114,"Hint":"Is the matching PHP module installed and enabled?","CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:68.0) Gecko\/20100101 Firefox\/68.0","version":"16.0.3.0"}

here is part of my config.php

'filelocking.enabled' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'redis' => [
     'host' => '/run/redis/redis.sock',
     'port' => 0,
     'dbindex' => 0,
     'timeout' => 1.0,
  ],
  'memcache.locking' => '\OC\Memcache\Redis',

I did comment out distributed part like this:

'filelocking.enabled' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  #'memcache.distributed' => '\OC\Memcache\Redis',
  #'redis' => [
  #   'host' => '/run/redis/redis.sock',
  #   'port' => 0,
  #   'dbindex' => 0,
  #   'timeout' => 1.0,
  #],
  'memcache.locking' => '\OC\Memcache\Redis',

and my nextcloud is back to life. BUT of course I feel slower response.

what is also strange to me and I am not sure what to do.
I did login as admin and clicking Administration -> Overview
I am getting this message in log

{"reqId":"cxXcliaKolCMxi2g8vXG","level":3,"time":"2019-07-16T20:06:20+00:00","remoteAddr":"192.168.10.117","user":"adminko","app":"PHP","method":"GET","url":"\/index.php\/heartbeat","message":"PHP Startup: Unable to load dynamic library 'redis' (tried: \/usr\/lib\/php\/modules\/redis (\/usr\/lib\/php\/modules\/redis: cannot open shared object file: No such file or directory), \/usr\/lib\/php\/modules\/redis.so (\/usr\/lib\/php\/modules\/redis.so: undefined symbol: igbinary_serialize)) at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:68.0) Gecko\/20100101 Firefox\/68.0","version":"16.0.3.0"}

BUT I can see redis.so on that path and has correct permisions.

thank you very mych for help

Is your Redis service running?

Was going to be my question as well. It sounds like maybe the service is not automatically starting at boot?

I have the same problem (same message) after update of php-redis-5.0.0 to php-redis-5.0.1
After Downgrade to php-redis-5.0.0 Nextcloud is running again

Raspi with Arch Linux ARM

And a hint: I had and have to enable the redis extension in /etc/php/conf.d/redis.ini after each Update/Downgrade.

Redis-Service was always running.

If you’re using ArchLinux, php-igbinary (one of dependency of php-redis) was recently moved to the official repo. You’ll need to enable igbinary.so as well at /etc/php/conf.d/igbinary.ini

3 Likes

yes, enabling php-igbinary did help, thanks

Thanks a lot, that did it.

This happened to me after doing

apt-get update && apt-get upgrade && apt-get dist-upgrade && apt-get autoremove

This somehow broke redis caching.

First, check nextcloud logs:

tail --follow /var/www/nextcloud/data/nextcloud.log  -n 100

The following steps solved “not available for local cache”:

nano /var/www/nextcloud/config/config.php

Make sure:

  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'redis' => [
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  ],
  'filelocking.enabled' => true,
  'memcache.locking' => '\OC\Memcache\Redis',

Make sure you can connect to the socket:

sudo redis-cli -s /var/run/redis/redis.sock
"info"

Make sure that you are using the correct php version (for me 7.3).
I suggest adding a phpinfo.php file to your nextcloud www data drectory somewhere permanently (if you’re local hosting).

Update PHP.ini:

sudo nano /etc/php/7.3/apache2/php.ini

Add

extension=redis.so
extension=igbinary.so

Restart apache and look at logs:

/etc/init.d/apache2 restart
tail --follow /var/log/apache2/error.log

If redis.so or igbinary.so cannot be found, install with pecl:

pecl channel-update pecl.php.net
sudo apt-get install php7.3-dev
pecl install igbinary
sudo pecl install redis
# "yes" for igbinary
# "yes" for lzwcompression
# "no" for other

Restart apache:

/etc/init.d/apache2 restart
tail --follow /var/log/apache2/error.log

No errors should appear and you should be able to access nextcloud.