Nextcloud: Redis server went away

This can happen when the Redis environment is configured incorrectly, and/or when the redis-server.sock file has the wrong permissions.

177 views
d

By. Jacob

Created: 2023-09-25 22:22

RedisException: Redis server went away

On my Nextcloud server I was getting an error like this. It can happen after updating server software or changing servers. A common cause for it is that you forgot to install Redis, or you did not configure Redis properly.

Verify that your Redis redis-server.sock file has the right permissions, and that your www-data user is added to the redis group. E.g:

1. Setup Redis to use redis-server.sock with the right permissions. Edit your /etc/redis.conf file like this:

unixsocket /var/run/redis/redis-server.sock
unixsocketperm 775

2. (If needed), verify your Nextcloud configuration file is pointing at the Redis .sock file; Debian/Ubuntu might keep create the file in:

/var/run/redis/redis-server.sock

3. Add the www-data user to the Redis group:

usermod -a -G redis www-data

Syntax:

usermod -a -G groupname username

-a or --append — add the user to the group'(s).

-G or --groups — the group'(s) to add the user to.

4. Restart your server to refresh the group permissions:

sudo reboot now

Also, make sure the php-redis module is installed:

sudo apt install php8.2-redis

Surprisingly, some of the only documentation I found online about this issue were incorrectly telling people to add the redis user to the www-data user group. Don't do that. It's obviously the other way around!

Links

  1. Memory caching - docs.nextcloud.com

Tell us what you think:

  1. You need to route ocm-provider requests to index.php to have the error go away. The error started showing after I upgraded my Nextcloud server some time ago, and I have not had time to fix it until now.
  2. The Nextcloud notes app is worth using, because it stores notes in a logical and natural way, secures your notes and ensures you will never lose access to them.
  3. How to toggle maintenance mode on or off for your Nextcloud server
  4. Prevent your Nextcloud data directory from being accessible from the internet.

More in: Nextcloud