Permission denied for Redis?

I’ve a suspicious error, maybe you have an answer?
{“reqId”:“xxxx”,“level”:3,“time”:“2017-08-18T19:47:23+02:00”,“remoteAddr”:“xx.xx”,“user”:“xxx”,“app”:“PHP”,“method”:“GET”,“url”:"/ocs/v2.php/apps/notifications/api/v2/notifications",“message”:"
Redis::connect(): connect() failed:
Permission denied at /usr/share/webapps/nextcloud/lib/private/RedisFactory.php#82",
“userAgent”:“Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0”,“version”:“12.0.2.0”}

I configured Redis as socket:
/run/redis/redis.sock

ls -lah /run/redis/

drwxr-xr-x 2 redis redis 60 18. Aug 19:42 .
drwxr-xr-x 29 root root 920 18. Aug 19:42 …
srwx------ 1 redis redis 0 18. Aug 19:42 redis.sock

nextcloud config.php like this:
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘/run/redis/redis.sock’,
‘port’ => 0,
),

I didn’t get it! thanks for help I’m stupid now :slight_smile: !

The socket must be accessible for www-data. You first have to change the chmod of the socket to 770 that the redis group can access it, make changes in /etc/redis/redis.conf:

unixsocketperm 770

and then add www-data to the redis group in /etc/group:
redis:x:110:www-data

2 Likes

okay i changed unixsocketperm my /etc/group shows redis:x:994:http

I have the same issue and haven’t managed to solve it yet either have now found the solution.

The relevant part of config/config.php says:

  'memcache.local' => '\OC\Memcache\APCu',
 'memcache.locking' => '\OC\Memcache\Redis',
 'filelocking.enabled' => 'true',
 'redis' =>
 array (
   'host' => '/var/run/redis/redis.sock',
   'port' => 0,
   'timeout' => 0.0,
 ),
  'cache_path' => '/srv/nextcloud_data/cache',

and the /etc/redis/redis.conf says:

bind 127.0.0.1
protected-mode yes
port 0
tcp-backlog 511
unixsocket /var/run/redis/redis.sock
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
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
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
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
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

What was missing is that I had to restart the (whole) server for Redis to start working. No idea why just restarting Redis wasn’t enough, but restarting the server solved the issue for me.

@carlitoco, does this solve your problem as well?

only if I activate daemonize its not working anymore…