How to set up redis or memcached?

Hello!

Ubuntu 20.04
PHP 7.4
Nginx 1.18

HOW TO SET UP MEMCACHED OR REDIS?
I always add what it says in guides and docs, but it doesn’t work! No Redis, nor MEMcached. Just APCu works.

What I did wrong if I use the official documentation?

Any idea how to set up Redis or Memcached? What to add to config exactly? I also tried 5 other guides but always got this message:

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.

Need help guys! Please.

How about a less agressive tone? :slight_smile:

I have done it several times following the official guides, so it is not an issue with the documentation.

There must be a specific issue with your setup and the information that you have given here isn’t sufficient to tell what it might be. Sorry.

Edit: For Redis: Tried it in IP mode or socket mode respectively? In my experience IP more works more reliable, but unix socket mode is apparently better if it works.

2 Likes

Man I just spent 2 days and still didn’t solve the problem that’s why I’m a little bit agressive. Sorry. Yes I tried.

Could you please give me your lines added to config.php?

Does by typing :

service redis-server status

You get active or inactive ?

1 Like

Active: active (running) since Sun 2020-06-28 20:06:29 ; 54s ago

In the guide it says to add these to the config.php

'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'redis' => [
     'host'     => '/var/run/redis/redis.sock',
     'port'     => 0,
     'dbindex'  => 0,
     'password' => 'secret',
     'timeout'  => 1.5,
],

But they did even mentioned that I have to change the port of redis and IDK where… Okay I’m sad guys.

Maybe someone has a good guide?

In this configuration of the config.php you have to configured redis server in unix socket mode.
Go in this how to on the redis section

1 Like

In unix socket mode no port is needed AFAIK.

Try something like this to see if IP mode works:

'memcache.locking' => '\OC\Memcache\Redis',
'memcache.distributed' => '\OC\Memcache\Redis',
'redis' => [
     'host' => 'localhost',
     'port' => 6379,
],

Maybe replace localhost with 127.0.0.1

Edit: remove the password part if you have not configured that on the Redis side. It isn’t really needed anyways.

1 Like

@danonanon

hey and welcome to the forum.

just to remind you: watch your language.
anyone here does like swearing and so you are asked to edit your initial posting and remove your insulting language.
i did that for you in your headline because i’m such a nice guy (believe it or not :slight_smile:

and be sure that you’d rise chances if you are nice… the nicer the better.

understandable that you might be a wreck after 2 days… but please… it’s nothing to freak out about.

ok? i hope i can count on you

cheers
jimmy

1 Like

Nemskiller yeah. When I’ve done the 4th thing you gave me, add these
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘redis’ => [
‘host’ => ‘localhost’,
‘port’ => 0,
‘dbindex’ => 0,
‘password’ => ‘secret’,
‘timeout’ => 1.5,
],

And it works.

Then I tried the @Krischan config
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘redis’ => [
‘host’ => ‘localhost’,
‘port’ => 6379,
],
And it works too… Funny but true!

So everything’s fine right now?

I Just delete
'memcache.local' => '\OC\Memcache\APCu',

And now it shows me that I have to install memcached and so on. Why if I use redis? Or redis should be in line with Apcu anyway?

This explains it:
https://docs.nextcloud.com/server/19/admin_manual/configuration_server/caching_configuration.html

Yes you can use Redis for local caching too. But APCu is apparently a bit faster in that specific case:

Additional notes for Redis vs. APCu on memory caching

APCu is faster at local caching than Redis. If you have enough memory, use APCu for Memory Caching and Redis for File Locking. If you are low on memory, use Redis for both.

1 Like

@Krischan
Maybe I don’t even need that Redis bro?
Just APCu is enough for me. Who knows…

'memcache.local' => '\OC\Memcache\Redis',
 'memcache.locking' => '\OC\Memcache\Redis',
 'memcache.distributed' => '\OC\Memcache\Redis',
 'redis' => [
     'host' => 'localhost',
     'port' => 6379,
],

This works too. Thanks guys, nice community. You are prem guys. Much appreciate it.

that’s nice to hear…

but haven’t you forgotten something?? in your initial posting?

you could use the pen-icon to edit it… and i’m still in high hopes that you would be nice as well… :wink:

1 Like

@JimmyKater
Yes of course! No problem bro! Have a nice time :slight_smile:

1 Like