Redis-server doesn't work

Nextcloud version __: 28.0.5
Operating system _: `Debian Bookworm’

Apache or nginx version __: Apache/2.4.59

PHP version __: php8.2

The issue you are facing:
I installed via NCP script, it didn’t 100% complete, I am having issues I tried installing 5 times and couldn’t get it to complete fully.

My redis is not working.
I had to take all of this out of my config.php just to get my nextcloud to work.

‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => ‘true’,
‘redis’ =>
array (
‘host’ => ‘/var/run/redis/redis.sock’,
‘port’ => 0,
‘timeout’ => 0.0,
),

Redis-server, php-redis, and php8.2-redis are installed.
I looked here Installing Nextcloud on Ubuntu with Redis, APCu, SSL & Apache | Jason Bayton
My
/etc/redis/redis.conf is configured just like on that page

Steps to replicate it:

  1. If I add those lines to my config.php and restart php8.2-fpm, redis-server, and apache2, Nextcloud will no longer work.
  2. I tried “update-alternatives --config php” switching to php8.1 and it makes no difference.

Wow I hadn’t looked at that log till now, it’s full of redis NO Auth errors.
I googled a solution and saw to do this:

So I just opened /etc/redis/redis.conf

I ran

openssl rand 60 | openssl base64 -A

to make a password

where it says requirepass I entered the pass I generated.

Then ran

redis-cli -h 127.0.0.1 -p 0 -a “$your_password”

It says connection refused.
That was what a search result said to do.

is it right that you set a “requirepass” in redis.conf but not a corresponding parameter in your nextcloud config?

If so please check this one

Never the less i see you are using the unix socket instead of standard port 6379
good so far → but then you don’t need the requiredpass option in redis.conf.

Comment it out and restart redis!
And i would FLUSH the redis cache

and

https://www.cyberciti.biz/faq/how-to-flush-redis-cache-and-delete-everything-using-the-cli/

Good luck!

1 Like

As I said I had difficulty installing NCP this time around, the script failed installing php the first time. So before running the script manually installed some of the packages it got stuck on. Which were php and resolvconf. Thats how I ended up on php8.2 rather than php8.1, but if theres much php configuring the script does, I realized I should switch back to 8.1.
So I uninstalled php8.2-fpm and php8.2-common and switched it over.
Ok so far.

I think I got it!

So switched to php8.1
php8.1-apcu wasnt installed! I installed it.
Commented out the requirepass line in /etc/redis/redis.conf
Added the configurations back to my nextcloud config.php
restarted apache2 and it works.
Is that all?

Can’t clear the cache tho,
when I run
redis-cli FLUSHALL
it says:
Could not connect to Redis at 127.0.0.1:6379: Connection refused

But that’s ok.

One more thing, when I ssh into my server it says:

An: command not found
-bash: /usr/share/bash-completion/completions/ncp: line 2: syntax error near unexpected token ('`

Where’s the syntax error ??

ok?

I think the connect to redis should be established via socket (nextcloud config)?

So if socket is up → check if /var/run/redis/redis.sock exist
(in my case the path is /var/run/redis/redis-server.sock)!

Then i can FLUSH my redis cache by using

redis-cli -s /var/run/redis/redis-server.sock
(or redis-cli -s /var/run/redis/redis.sock if this is your’s path)

and

FLUSHALL

I’m telling redis-cli to connect via socket not ip:port

If you want to try a little script copy it and make it executable

#!/bin/bash
printf "Flush Redis"
redis-cli -s /var/run/redis/redis.sock <<EOF
FLUSHALL
quit
EOF

(but first check your path to redis…sock! if it is redis.sock or redis-server.sock depends your settings in the redis.conf)

1 Like

Thankyou redis cache cleared. Last thing i need help with is this:

One more thing, when I ssh into my server it says:

An: command not found
-bash: /usr/share/bash-completion/completions/ncp: line 2: syntax error near unexpected token ('`

Where’s the syntax error ??

I updated to nextcloud 29.0.0
All is working, problems resolved.
Thanks!