Redis-server misconfiguration

Nextcloud version 21
mariadb 10.5
php8.2
debian 11

I think I misconfigured something with redis-server. When I try to log into the UI it takes forever.

output from tail /var/log/redis/redis-server.log:
751:C 07 Aug 2023 15:22:12.194 # WARNING supervised by systemd - you MUST set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit.
2751:C 07 Aug 2023 15:22:12.195 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2751:C 07 Aug 2023 15:22:12.195 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=2751, just started
2751:C 07 Aug 2023 15:22:12.195 # Configuration loaded
2751:M 07 Aug 2023 15:22:12.196 # Configured to not listen anywhere, exiting.
2754:C 07 Aug 2023 15:22:12.446 # WARNING supervised by systemd - you MUST set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit.
2754:C 07 Aug 2023 15:22:12.446 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2754:C 07 Aug 2023 15:22:12.446 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=2754, just started
2754:C 07 Aug 2023 15:22:12.446 # Configuration loaded
2754:M 07 Aug 2023 15:22:12.447 # Configured to not listen anywhere, exiting.
if that helps.
The last thing I changed was the TimeoutStopSec value

I am not quite sure what else to post and I am not even sure if redis-server is even connected to nextcloud.

Any help would be much appreciated.

Thanks

This is the cause of your problem!

How is your redis server configured?

In other words, what is the output of

grep -Ev "(^#|^$)" /etc/redis/redis.conf

Thanks for the reply Ernolf!

The output you requested:

bind 127.0.0.1 ::1
protected-mode yes
port 0
tcp-backlog 511
unixsocketperm 770
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis/redis-server.pid
loglevel notice
logfile /var/log/redis/redis-server.log
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir /var/lib/redis
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
oom-score-adj no
oom-score-adj-values 0 200 800
appendonly no
appendfilename “appendonly.aof”
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events “”
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes

Let me know if you need anything else,

Thanks again

From this I see enough and this corresponds exactly to my assumption:

You have defined

port 0

but no Unix socket.
So uncomment the line

unixsocket /run/redis/redis-server.sock

and set

supervised yes


EDIT:

supervised systemd

see:



(or auto)

and

stop-writes-on-bgsave-error no

Configure memory management to your needs. This are my values:

maxmemory 512MB
maxmemory-policy volatile-lfu
maxmemory-samples 10

But you might choose others, depending on the resources you have

and I have

appendfsync no

because it is faster than evrsync

I don’t know if I missed something, but the unixsocket was the most important thing. Without that, redis cannot hear anything


And this would be the counterpart in the config/config.php:

  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0,
  ),

Hope this helps,
much luck!

1 Like

Thanks again Ernolf!

I made the above changes and still got a failure upon restarting redis.

systemctl status redis-server.service gave this:

● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2023-08-13 08:24:11 MST; 1min 5s ago
Docs: https://redis.io/docs/,
man:redis-server(1)
Process: 62740 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd --daemonize no (code=exited, status=1/FAILURE)
Main PID: 62740 (code=exited, status=1/FAILURE)

Aug 13 08:24:11 server.tomd.rocks systemd[1]: Failed to start Advanced key-value store.
Aug 13 08:24:11 server.tomd.rocks systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 5.
Aug 13 08:24:11 server.tomd.rocks systemd[1]: Stopped Advanced key-value store.
Aug 13 08:24:11 server.tomd.rocks systemd[1]: redis-server.service: Start request repeated too quickly.
Aug 13 08:24:11 server.tomd.rocks systemd[1]: redis-server.service: Failed with result ‘exit-code’.
Aug 13 08:24:11 server.tomd.rocks systemd[1]: Failed to start Advanced key-value store.

And the new output of grep -Ev "(^#|^$)" /etc/redis/redis.conf is:

bind 127.0.0.1 ::1
protected-mode yes
port 0
tcp-backlog 511
unixsocket /var/run/redis/redis-server.sock
unixsocketperm 770
timeout 0
tcp-keepalive 300
daemonize yes
supervised yes
pidfile /var/run/redis/redis-server.pid
loglevel notice
logfile /var/log/redis/redis-server.log
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error no
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir /var/lib/redis
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
maxmemory 512MB
maxmemory-policy volatile-lfu
maxmemory-samples 10
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
oom-score-adj no
oom-score-adj-values 0 200 800
appendonly no
appendfilename “appendonly.aof”
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events “”
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes

On my system the unixsocket was set to /var/run/redis/redis-server.sock though I can’t see why that would make any difference.

A couple of thoughts,

I had daemonize set to yes so I set it once to no and then commented it out entirely both to know avail.

also this warning:
WARNING supervised by systemd - you MUST set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit.

As per some instruction elsewhere,I had set the TimeoutStopsec value to 5s but couldn’t find a TimeoutStartSec value to configure. Should I add one? or reset the TimeoutStopSec back to 0?

Thanks again

The output of your /var/log/redis/redis-server.log would be from interest.

Interesting, there is nothing in that log file. No output and when I open the file in an editor its blank.

How did you restart the service?

Because it looks like you did not restart it. Your post is from August 13, 18:36 and the ‘systemctl status’ echo show last wrong start from 08:24, so from 10 hours earlier.

systemctl restart redis-server

OK. So try to switch loglevel

to verbose and try restart again.

Ok switched loglevel to verbose and restarted and still nothing in redis-server.log.

I don’t understand seems like there should be something there?

OK, I have found the error and it might be my fault:

I looked through your settings too quickly and too superficially and reacted purely from my head. I assumed that you would deal with each individual configuration parameter again. That was my fault. Excuse me!

From the explanation of this parameter you can see that there is no “yes” at all, only “no”, “upstart”, “systemd” and “auto”:

# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
#   supervised no      - no supervision interaction
#   supervised upstart - signal upstart by putting Redis into SIGSTOP mode
#                        requires "expect stop" in your upstart job config
#   supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
#   supervised auto    - detect upstart or systemd method based on
#                        UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
#       They do not enable continuous pings back to your supervisor.
supervised auto

So set it to ‘auto’ or ‘systemd’ and then you can also lower the log level to ‘notice’ again, because then it should work.
sorry again please! :pray:


further I noticed that appendonly.aof is between curly double quotes (“ ” ):

instead of straight double quotes ("" ):

appendfilename "appendonly.aof"

the same for

but that may also be because you incorrectly posted it as text to be interpreted by markdown instead of posting it in a → fenced code block ← (Ctrl-E) as usual in markdown.

Hope that helps,
much luck!

Thanks ernolf, no need to apologize I appreciate your help. That last one did it and there are no more errors. Now I can move on to the next thing lol.

Thanks again

1 Like