Can't get memcache to work (Redis) after fresh install

Hello,
quite a newbie here, Iā€™m looking for some help after one full day struggling with this issue.

I have freshly installed a VM with Debian Buster to serve as LAMP environment for web apps.
Installed Nextcloud and got rid of all annoying warnings but this one.

Iā€™ve tryied all I have found, in this and other forums, for debian or ubuntu set-ups, but I keep getting this error:

  • No memory cache has been configured. To enhance performance, please configure a memcache, if available. Further information can be found in the documentation.

Redis looks good:

# service redis-server status
ā— redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-04-21 17:39:13 CEST; 3min 44s ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
  Process: 5202 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
 Main PID: 5203 (redis-server)
    Tasks: 4 (limit: 2359)
   Memory: 7.0M
   CGroup: /system.slice/redis-server.service
           ā””ā”€5203 /usr/bin/redis-server 127.0.0.1:0

and my config file doesnā€™t give troubles:

'memcache.distributed' => '\OC\Memcache\Redis',
  'redis' => [
     'host' => '/var/run/redis/redis-server.sock',
     'port' => 0,
     'timeout' => 0.5,
     'dbindex' => 0,
  ],
  'memcache.locking' => '\OC\Memcache\Redis',

Nothing relevant shown in nextcloud log file.

Any help will be really really appreciated!

Thank you very much.

  • First of all, how do you want to access Redis, using a socket ( /var/run/redis/redis-server.sock) or the loopback device (127.0.0.1)?
  • Second, Redis doesnā€™t look good, if you set the port number to ā€œ0ā€ instead of using the default port 6379 :wink:

Please have a look on the Nextcloud documentation how Redis need to be configured.

Additionally it is always a good idea to use the search function of the forum to find a solution for a problem: Search results for 'redis config' - Nextcloud community

hello j-ed and first of all thanks for the prompt reply!

I have followed the documentation and tryied to setup both ā€˜127.0.0.1ā€™ and ā€˜localhostā€™ on port 6379, and then decided to give a go to the unix socket (enabled in redis config file) on port 0.

Apart from this you are right, Redis doesnā€™t look good anyway, and the log file says so.
I forgot I moved the log file to /var/log/nextcloud/nextcloud.log, so I was looking to an ā€œoldā€ logfile, generated before Redis setup.

here some log:

[no app in context] Error: RedisException: Connection refused at <<closure>>

 0. /var/www/html/nextcloud/lib/private/RedisFactory.php line 92
    Redis->connect("localhost", 6379, 0)
 1. /var/www/html/nextcloud/lib/private/RedisFactory.php line 108
    OC\RedisFactory->create()
 2. /var/www/html/nextcloud/lib/private/Memcache/Redis.php line 42
    OC\RedisFactory->getInstance()
 3. /var/www/html/nextcloud/lib/private/Memcache/Factory.php line 135
    OC\Memcache\Redis->__construct("dbd8ab6a165729fa7138df345cad5b3d/lock")
 4. /var/www/html/nextcloud/lib/private/Server.php line 971
    OC\Memcache\Factory->createLocking("lock")
 5. /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php line 118
    OC\Server->OC\{closure}("*** sensitive parameters replaced ***")
 6. /var/www/html/nextcloud/lib/private/ServerContainer.php line 125
    Pimple\Container->offsetGet("OCP\\Lock\\ILockingProvider")
 7. /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 162
    OC\ServerContainer->query("OCP\\Lock\\ILockingProvider")
 8. /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php line 114
    OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}("*** sensitive parameters replaced ***")
 9. /var/www/html/nextcloud/lib/private/ServerContainer.php line 125
    Pimple\Container->offsetGet("LockingProvider")
10. /var/www/html/nextcloud/lib/private/Server.php line 1916
    OC\ServerContainer->query("LockingProvider")
11. /var/www/html/nextcloud/lib/private/Files/View.php line 116
    OC\Server->getLockingProvider()
12. /var/www/html/nextcloud/lib/private/Server.php line 762
    OC\Files\View->__construct()
13. /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php line 118
    OC\Server->OC\{closure}("*** sensitive parameters replaced ***")
14. /var/www/html/nextcloud/lib/private/ServerContainer.php line 125
    Pimple\Container->offsetGet("OCP\\Http\\Client\\IClientService")
15. /var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 389
    OC\ServerContainer->query("OCP\\Http\\Client\\IClientService", true)
16. /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 70
    OC\AppFramework\DependencyInjection\DIContainer->query("OCP\\Http\\Client\\IClientService", true)
17. /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 100
    OC\AppFramework\Utility\SimpleContainer->buildClass(ReflectionClass  ... "})
18. /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 115
    OC\AppFramework\Utility\SimpleContainer->resolve("OCA\\Support\\S ... e")
19. /var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 415
    OC\AppFramework\Utility\SimpleContainer->query("OCA\\Support\\S ... e")
20. /var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 386
    OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback("OCA\\Support\\S ... e")
21. /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 70
    OC\AppFramework\DependencyInjection\DIContainer->query("OCA\\Support\\S ... e", true)
22. /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 100
    OC\AppFramework\Utility\SimpleContainer->buildClass(ReflectionClass  ... "})
23. /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 115
    OC\AppFramework\Utility\SimpleContainer->resolve("OCA\\Support\\S ... r")
24. /var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 415
    OC\AppFramework\Utility\SimpleContainer->query("OCA\\Support\\S ... r")
25. /var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 386
    OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback("OCA\\Support\\S ... r")
26. /var/www/html/nextcloud/apps/support/lib/AppInfo/Application.php line 45
    OC\AppFramework\DependencyInjection\DIContainer->query("OCA\\Support\\S ... r")
27. /var/www/html/nextcloud/apps/support/appinfo/app.php line 27
    OCA\Support\AppInfo\Application->register()
28. /var/www/html/nextcloud/lib/private/legacy/app.php line 266
    require_once("/var/www/html/n ... p")
29. /var/www/html/nextcloud/lib/private/legacy/app.php line 155
    OC_App::requireAppFile(OCA\Support\AppInfo\Application {})
30. /var/www/html/nextcloud/lib/private/legacy/app.php line 128
    OC_App::loadApp("support")
31. /var/www/html/nextcloud/lib/base.php line 645
    OC_App::loadApps(["session"])
32. /var/www/html/nextcloud/lib/base.php line 1089
    OC::init()
33. /var/www/html/nextcloud/remote.php line 113
    require_once("/var/www/html/nextcloud/lib/base.php")

Iā€™m honest, I donā€™t actually know how to read this.

I think the following is the most recent one:

{"reqId":"00xhXCaUutEddHK2TiLA","level":3,"time":"2020-04-21T15:26:33+00:00","remoteAddr":"10.0.7.10","user":"--","app":"no app in context","method":"GET","url":"/nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications","message":{"Exception":"RedisException","Message":"Connection refused","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/RedisFactory.php","line":92,"function":"connect","class":"Redis","type":"->","args":["localhost",6379,0]},{"file":"/var/www/html/nextcloud/lib/private/RedisFactory.php","line":108,"function":"create","class":"OC\\RedisFactory","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Memcache/Redis.php","line":42,"function":"getInstance","class":"OC\\RedisFactory","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Memcache/Factory.php","line":135,"function":"__construct","class":"OC\\Memcache\\Redis","type":"->","args":["dbd8ab6a165729fa7138df345cad5b3d/lock"]},{"file":"/var/www/html/nextcloud/lib/private/Server.php","line":971,"function":"createLocking","class":"OC\\Memcache\\Factory","type":"->","args":["lock"]},{"file":"/var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OCP\\Lock\\ILockingProvider"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":162,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OCP\\Lock\\ILockingProvider"]},{"file":"/var/www/html/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":"/var/www/html/nextcloud/lib/private/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["LockingProvider"]},{"file":"/var/www/html/nextcloud/lib/private/Server.php","line":1916,"function":"query","class":"OC\\ServerContainer","type":"->","args":["LockingProvider"]},{"file":"/var/www/html/nextcloud/lib/private/Files/View.php","line":116,"function":"getLockingProvider","class":"OC\\Server","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Server.php","line":762,"function":"__construct","class":"OC\\Files\\View","type":"->","args":[]},{"file":"/var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OCP\\Http\\Client\\IClientService"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":389,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OCP\\Http\\Client\\IClientService",true]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":70,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCP\\Http\\Client\\IClientService",true]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":100,"function":"buildClass","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":[{"name":"OCA\\Support\\Service\\SubscriptionService","__class__":"ReflectionClass"}]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":115,"function":"resolve","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCA\\Support\\Service\\SubscriptionService"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":415,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCA\\Support\\Service\\SubscriptionService"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":386,"function":"queryNoFallback","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCA\\Support\\Service\\SubscriptionService"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":70,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCA\\Support\\Service\\SubscriptionService",true]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":100,"function":"buildClass","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":[{"name":"OCA\\Support\\Subscription\\SubscriptionAdapter","__class__":"ReflectionClass"}]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":115,"function":"resolve","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCA\\Support\\Subscription\\SubscriptionAdapter"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":415,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCA\\Support\\Subscription\\SubscriptionAdapter"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":386,"function":"queryNoFallback","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCA\\Support\\Subscription\\SubscriptionAdapter"]},{"file":"/var/www/html/nextcloud/apps/support/lib/AppInfo/Application.php","line":45,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCA\\Support\\Subscription\\SubscriptionAdapter"]},{"file":"/var/www/html/nextcloud/apps/support/appinfo/app.php","line":27,"function":"register","class":"OCA\\Support\\AppInfo\\Application","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/legacy/app.php","line":266,"args":["/var/www/html/nextcloud/apps/support/appinfo/app.php"],"function":"require_once"},{"file":"/var/www/html/nextcloud/lib/private/legacy/app.php","line":155,"function":"requireAppFile","class":"OC_App","type":"::","args":[{"__class__":"OCA\\Support\\AppInfo\\Application"}]},{"file":"/var/www/html/nextcloud/lib/private/legacy/app.php","line":128,"function":"loadApp","class":"OC_App","type":"::","args":["support"]},{"file":"/var/www/html/nextcloud/lib/base.php","line":645,"function":"loadApps","class":"OC_App","type":"::","args":[["session"]]},{"file":"/var/www/html/nextcloud/lib/base.php","line":1089,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/nextcloud/ocs/v1.php","line":33,"args":["/var/www/html/nextcloud/lib/base.php"],"function":"require_once"},{"file":"/var/www/html/nextcloud/ocs/v2.php","line":24,"args":["/var/www/html/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/lib/private/RedisFactory.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36","version":"18.0.3.0","id":"5ea0a5aa01dfd"}

Thank you for your support

I still see an ā€œaccess deniedā€ error in the log file. If you want to access Redis using a socket, you only need to set 'port' => 0, in the Nextcloud configuration but NOT in the Redis configuration itself.
Additionally you have to make sure that the web server user, e.g. www-data, is allowed to access the socket file. If a assume that the Redis daemon is started under the user ā€œredisā€ with group ā€œredisā€ you should make sure that the web servers user is a member of that group too.
How this need to be done in detailed has been described in this forum multiple times. See e.g.

https://help.nextcloud.com/search?q=redis%20socket%20group

Thanks again j-ed.

so, I have to figure out if I made mistakes two days ago, 'cause it wasnā€™t working and I started looking out for system wide issues and I have followed different guides.

For sure, in one for Redis on Debian 10 I found that to use unix socket you should change to port 0 and enable socket/disable TCP commenting and uncommenting lines in redis.conf.

I also understand that www-data should have access.
While in some guides (i.e https://guides.wp-bullet.com/how-to-configure-redis-to-use-unix-socket-speed-boost/) they invite you to add redis to group www-data and give ownership of folders to www-data, I find more logical to do the opposite, as found in nextcloud forums and already implemented at the time. So I have:

# groups www-data
www-data : www-data redis

www-data member of redis group. So we should be good with permissions:

# ls -l redis-server.sock 
srwxrwx--- 1 redis redis 0 Apr 21 17:39 redis-server.sock

since Iā€™m going to use unix socket, I have set port 0, as suggested in the previously mentioned guide and in this one: https://github.com/NodeRedis/node-redis/issues/204. redis.conf seems to confirm this:

# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
#port 6379
port 0

and uncommented unix socket:

# Unix socket.
#
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
unixsocket /var/run/redis/redis-server.sock
unixsocketperm 770

so, Iā€™m not getting what prevents nextcloud to connect to the active redis server:

 redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor pre
   Active: active (running) since Thu 2020-04-23 14:24:47 CEST; 14s ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
  Process: 22019 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exi
 Main PID: 22020 (redis-server)
    Tasks: 4 (limit: 2359)
   Memory: 7.1M
   CGroup: /system.slice/redis-server.service
           ā””ā”€22020 /usr/bin/redis-server 127.0.0.1:0

although it gives back also this:

redis-server.service: Can't open PID file /run/redis/redis-server.pid (yet?) after start: No such file or directory

but it does exist:

s# ls -lh /run/redis
total 4.0K
-rwxrwx--- 1 redis redis 6 Apr 23 14:34 redis-server.pid
srwxrwxr-x 1 redis redis 0 Apr 23 14:34 redis-server.sock

also, I donā€™t fully get why is redis lookin in /run/redis when soket file is in /var/run/redis, and ā€œassociateā€ .pid too:

s# ls -lh /var/run/redis
total 4.0K
-rwxrwx--- 1 redis redis 6 Apr 23 14:34 redis-server.pid
srwxrwxr-x 1 redis redis 0 Apr 23 14:34 redis-server.sock

.pid file had both 700 permission, but I changed to 770 to allow redis group -> www-data to write on it, but this didnā€™t change anything (blind attempt, prbably doesnā€™t even make sense since the .pid file is going to be managed by redis itself.)

Sorry, I really donā€™t know how to get out of thisā€¦

even giving up the idea of connecting via unix socket, and rolling back to TCP while i have no issues trying with:

# redis-cli
127.0.0.1:6379> 

I keep getting errors from nextcloud:

[no app in context] Error: RedisException: Redis server went away at <<closure>>

 0. /var/www/nextcloud/lib/private/Memcache/Redis.php line 54
    Redis->get("e4381a2cf9fedb2 ... g")
 1. /var/www/nextcloud/lib/private/URLGenerator.php line 172
    OC\Memcache\Redis->get("survey_client-app-dark.svg")
 2. /var/www/nextcloud/apps/survey_client/lib/Notifier.php line 86
    OC\URLGenerator->imagePath("survey_client", "app-dark.svg")
 3. /var/www/nextcloud/lib/private/Notification/Manager.php line 256
    OCA\Survey_Client\Notifier->prepare(OC\Notification\Notification {}, "en_GB")
 4. /var/www/nextcloud/apps/notifications/lib/Controller/EndpointController.php line 102
    OC\Notification\Manager->prepare(OC\Notification\Notification {}, "en_GB")
 5. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 170
    OCA\Notifications\Controller\EndpointController->listNotifications("v2")
 6. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 99
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Notification ... {}, "listNotifications")
 7. /var/www/nextcloud/lib/private/AppFramework/App.php line 125
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Notification ... {}, "listNotifications")
 8. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OCA\\Notificati ... r", "listNotifications", OC\AppFramework\ ... {}, {apiVersion: "v2 ... "})
 9. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({apiVersion: "v2 ... "})
10. /var/www/nextcloud/lib/private/Route/Router.php line 299
    call_user_func(OC\AppFramework\ ... {}, {apiVersion: "v2 ... "})
11. /var/www/nextcloud/ocs/v1.php line 82
    OC\Route\Router->match("/ocsapp/apps/no ... s")
12. /var/www/nextcloud/ocs/v2.php line 24
    require_once("/var/www/nextcloud/ocs/v1.php")

The program is usually doing what it has been told, by using default or individual values. You can set an individual path to the pid file using the pidfile configuration parameter.

Yep, I didnā€™t touch default values, and I donā€™t understand why they have both been generated in /var/run/redis AND in /run/redis by the system during installation.

furthermore, from redis.conf:

pidfile /var/run/redis/redis-server.pid

:man_shrugging:

Iā€™ve seen programs which require initial parameters to be parsed on the command line rather than set in a configuration file. Eventually this happens here too, although I must admit that I havenā€™t run into such a problem with Redis yet.

Thank you anyway for your support!

I am too tired now, I have purged redis and Iā€™m going to stick with APCu for a while since it started working straight away.

Iā€™ll give another try to redis in the future though, as it seems to be much more powerful solution to me. Probably I need to approach it with a fresh and empty mind.

Thanks again.

Hey, no guarantees, but have a look at this:

Holy @#$!.

Youā€™re not alone @FrA, Iā€™m having the exact same issue (Nextcloud 19.0.1, CentOS 8.2). I have redis running on my system, and I even KNOW itā€™s working and that user apache (thatā€™s what it is on CentOS - www-data equivalent for you) has access, you can test this like so:

If youā€™re using a websocketā€¦
ā€¦on Ubuntu/Debian: sudo -u www-data redis-cli -s /var/run/redis/redis.sock ping
ā€¦on CentOS/RHEL: sudo -u apache redis-cli -s /var/run/redis/redis.sock ping

You should get PONG as a response. I do. I still get an internal server error, and thatā€™s with:

unixsocket /var/run/redis/redis.sock
unixsocketperm 0770

ā€¦in my /etc/redis.conf, resulting inā€¦

$  ls -laFh /var/run/redis/
total 0
drwxr-xr-x.  2 redis redis  60 Aug  5 21:04 ./
drwxr-xr-x. 35 root  root  940 Aug  5 21:04 ../
srwxrwx---.  1 redis redis   0 Aug  5 21:04 redis.sock=

ā€¦and with apache in the appropriate groups:

$ groups apache
apache : apache redis

I have no idea what Iā€™m doing wrong. :stuck_out_tongue:

Hello mate, solution is here.
In redis.conf
unixsocket /var/run/redis/redis.sock
Change to
unixsocket /run/redis/redis.sock

Same for nextcloud/config/config.php
Restart both redis and httpd
That should work

This is probably problem with permissions on Linux level not Nextcloud per se.

U need to change default permissions of socket in /etc/redis/redis.conf

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

With default permissions only redis user is allowed to connect to redis socket.

Change unixsocketperm to:

unixsocketperm 770

Then restart redis:

systemctl restart redis-server

Add www-data to redis group

usermod -a -G redis www-data

Verify connection with this command

sudo -u www-data redis-cli -s /run/redis/redis-server.sock ping
PONG
2 Likes

Thank you both, Iā€™ll check it out in the weekend and let you know!

I was struggling with the same issue (same configuration, permission working, PONG received) for a while. Always receiving Internal Server Error.

What solved my issue was, to not only restart redis and apache2/httpd but also the php-fpm with

systemctl restart php7.3-fpm

After that (and lots of cursing for wasting several hours :sweat_smile:), redis was working fine with my Nextcloud.

3 Likes

This got mine working! Thanks for the info. :grinning:

Thanks again!

Sorry for the tremendous delay.
Adding www-data to redis group

usermod -a -G redis www-data

actually made it work properlyā€¦brilliant!

2 Likes

Thanks !! This should be in the documentation here: Transactional file locking ā€” Nextcloud latest Administration Manual latest documentation

Edit: Nevermind, its here: Memory caching ā€” Nextcloud latest Administration Manual latest documentation